Write a program that illustrate creation of a data file, C/C++ Programming

Assignment Help:

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.


Related Discussions:- Write a program that illustrate creation of a data file

Explain the function of five elements that are on a, explain the function o...

explain the function of five elements that are found on a motherboard#

Explain about the string constants in c language, Explain about the String ...

Explain about the String Constants in c language? A collection of characters included within a pair of double quotes is treated as string constant. The character may be numbers

Program, Byteland county is very famous for luminous jewels. Luminous jewel...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Arrays and pointers, i have an array of structs, and am trying to make a po...

i have an array of structs, and am trying to make a pointer that can point to a certain struct within the array

Cin, how we use the cin command and why we use this command????

how we use the cin command and why we use this command????

Coding, d county is very famous for luminous jewels. Luminous jewels are us...

d county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Necklaces

#decode the code, #Smugglers are becoming very smart day by day. Now they h...

#Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new techn

Explain public derivation, Public derivation Public derivations are muc...

Public derivation Public derivations are much more common than private derivations. In this situation: The private members inherited from the base class are inaccessible

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd