How to write files in C

How to write files in C

When writing a file, use the w option to open the file

/*
Example: write in file in C language
*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[]) {

	FILE *fp=fopen("test.txt","w"); // fp(file pointer)
	fputs("Hello lautturi",fp);
	fclose(fp);
	
	return 0;
}
Sourc‮ww:e‬w.lautturi.com
Created Time:2017-08-29 09:09:01  Author:lautturi