Jump to content

Write entire file: Difference between revisions

→‎{{header|C}}: more variants
(→‎{{header|C}}: more variants)
Line 80:
=={{header|C}}==
 
=== StandardDirty function fwrite()solution ===
<lang C>/*
* Write Entire File -- RossetaCode -- dirty hackish solution
*/
#define _CRT_SECURE_NO_WARNINGS // turn off MS Visual Studio restrictions
#include <stdio.h>
 
int main(void)
{
return 0 >= fputs("ANY STRING TO WRITE TO A FILE AT ONCE.",
freopen("sample.txt","wb",stdout));
}
</lang>
=== Standard function fwrite() ===
<lang C>/*
* Write Entire File -- RossetaCode -- ASCII version with BUFFERED files
Line 180 ⟶ 192:
}
</lang>
 
=== POSIX function write() ===
<lang C>/*
Cookies help us deliver our services. By using our services, you agree to our use of cookies.