int main() { FILE *ptr = NULL; char string[64] = "This content was produced by Tutorial64.c"; // ****** Reading a file ****** // ptr = fopen("myfile.txt", "r"); // fscanf(ptr, "%s", string); // printf("The content of this file has %s\n",string ); // ****** Writing a file ****** ptr = fopen("myfile.txt", "a"); fprintf(ptr, "%s", string); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter