{"id":5715,"date":"2023-01-24T08:16:52","date_gmt":"2023-01-24T08:16:52","guid":{"rendered":"http:\/\/ebhor.com\/?p=5715"},"modified":"2023-01-26T11:55:01","modified_gmt":"2023-01-26T11:55:01","slug":"writing-to-a-file-in-c-programming","status":"publish","type":"post","link":"https:\/\/www.ebhor.com\/writing-to-a-file-in-c-programming\/","title":{"rendered":"Writing to a File in C Programming"},"content":{"rendered":"\n
To write on a file there are following function available:<\/p>\n\n\n\n
Syntax :<\/strong><\/p>\n\n\n\n int fputc( int c, FILE *fp );<\/strong><\/p>\n\n\n\n Function fputc()\n<\/strong> returns the written character\nwritten on success and if\nthere is an error it will return EOF (Emd of File)<\/strong>.<\/p>\n\n\n\n Syntax :<\/strong><\/p>\n\n\n\n int fputs( const char *s, FILE *fp );<\/strong><\/p>\n\n\n\n Function fputs()\n<\/strong> returns the non-negative value on success and if\nthere is an error it will return EOF (Emd of File)<\/strong>.<\/p>\n\n\n\n Syntax :<\/strong><\/p>\n\n\n\n int fprintf(FILE *fp, const\n char *format, …)<\/strong><\/p>\n\n\n\n Example: Write a C program to write a single character into file using fputc() function in file handling.<\/strong><\/p>\n\n\n\n OUTPUT<\/strong><\/p>\n\n\n\n a Example: Write a C program to write a string into a file\nusing fputs() and fprintf() function in file handling.<\/strong><\/p>\n\n\n\n OUTPUT<\/strong><\/p>\n\n\n\n Hello hii how are you Description:<\/strong>\nWhen \nwe run the above program , it creates a new file Book1.txt<\/strong> in \/c directory and writes two lines\nusing fputs() and fprintf() functions.<\/p>\n\n\n\n Example : Write a C program to open a file, write in it and close the file.<\/strong><\/p>\n\n\n\n OUTPUT<\/strong><\/p>\n\n\n\n i am aditya from it department <\/p>\n","protected":false},"excerpt":{"rendered":" To write on a file there are following function available: Function fputc() : function fputc() write individual characters at a time to the file. The syntax of this function is \u2013 Syntax : int fputc( int c, FILE *fp ); Function fputc() returns the written character written on success and if there is an error it will return … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[283],"tags":[282,288,295],"yoast_head":"\n\n#include
BOOK1.txt<\/strong><\/p>\n\n\n\n\n#include
I am aditya
Book1.txt<\/strong><\/p>\n\n\n\n\n# include
Book1.txt<\/strong><\/p>\n\n\n\n