Skip to content

Instantly share code, notes, and snippets.

@linuxaged
Created August 27, 2012 08:58
Show Gist options
  • Save linuxaged/3486773 to your computer and use it in GitHub Desktop.
Save linuxaged/3486773 to your computer and use it in GitHub Desktop.
open file and write in c
/*
Name: Open_file_and_write.c
Date: 02/01/05
Description: Opens file by append example.
*/
#include <stdio.h>
int main()
{
FILE *file;
file = fopen("file.txt","a+"); /* apend file (add text to
a file or create a file if it does not exist.*/
fprintf(file,"%s","This is just an example :)"); /*writes*/
fclose(file); /*done!*/
getchar(); /* pause and wait for key */
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment