Name: Anonymous 2010-12-14 20:17
Can you guys PLEASE show me a very, very basic C program that writes input to a text file?
#include<stdlib.h>
int main(){system("cat > filename"); return 0;}
#include <stdlib.h>
int main(void)
{
system("echo input > file");
return 0;
}
<?php file_put_contents("filename", "contents"); ?>
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int c;
while ((c = getchar()) != EOF) putchar(c);
return ferror(stdin) || ferror(stdout) ? EXIT_FAILURE : 0;
}stdin to stdout. Redirecting stdout to a file is a job best left to the shell (if you don't know what this means, Google shell redirection).
int main()
{
char buf[256];
FILE*file = fopen("my","anus");
while(fread(buf,256,256, stdin)){
fwrite(buf, 256, 256, file);
}
}