Simple File Write Program Using C

// C program to illustrate fopen()
#include <stdio.h>
#include <stdlib.h>
int main()
    // pointer demo to FILE
    FILE* demo;
    // Creates a file "demo_file"
    // with file access as write-plus mode
    demo = fopen("demo_file.txt", "w+");
    // adds content to the file
    fprintf(demo, "%s %s %s", "Welcome",
            "to", "C Programming");
    // closes the file pointed by demo
    return 0;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.