Table of Contents
show
- Write a line to a file
- Â It outputs string to a stream.
Syntax
fputs
int fputs(const char *s, FILE *stream)
s − This is an array containing the null-terminated sequence of characters to be written.
stream − This is the pointer to a FILE object that identifies the stream where the string is to be written.
This function returns a non-negative value, or else on error it returns EOF.
Program
#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("myfile2.txt","w");
fputs("hello c programming",fp);
fclose(fp);
return 0;
}
Output


Views: 0