Created
August 27, 2012 13:35
-
-
Save murikadan/3488454 to your computer and use it in GitHub Desktop.
Write a string or a number to a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void writestring(char *); | |
void writedigit(int); | |
void writestring(char *s) | |
{ | |
FILE *fp; | |
char nl[]="\n"; | |
fp=fopen("output","a"); | |
fprintf(fp,"%s",nl); | |
fprintf(fp,"%s",s); | |
fclose(fp); | |
} | |
void writedigit(int s) | |
{ | |
FILE *fp; | |
char nl[]="\n"; | |
fp=fopen("output","a"); | |
fprintf(fp,"%s",nl); | |
fprintf(fp,"%d",s); | |
fclose(fp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
File is created if not existing, if exists then appended