write a program that illustrate creation of a


Write a Program that illustrate creation of a data file?

Here is a program to generate a Fibonacci series and write it into a Data file.

# include
main()
{
FILE *fpt;
int a=0,b=1,c,n=10;
fpt=fopen("fib.dat","w");
fprintf(fpt,"%d\t%d",a,b);
for(i=0;i {
c=a+b;
fprintf(fpt,"%d",c);
a=b;
b=c;
}
fclose(fpt);
}

The program starts by defining the stream pointer fpt, indicating the beginning of the data-file buffer area. A new data file that called as fib.dat is then opened for writing only. Next a for loop execute a series of operations and writes their result to the data file. The fprintf function is used to write every result to the data file. Notice that the fprintf needs specification of the stream pointer fpt as an argument.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: write a program that illustrate creation of a
Reference No:- TGS0305176

Expected delivery within 24 Hours