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

Calculation, write a program to calculate the cuboid

write a program to calculate the cuboid

Flowchart, questiCreate a flowchart that displays the student''''s average ...

questiCreate a flowchart that displays the student''''s average score for three quizzes. + Assume that there are 3 sections each having 5 students + The only valid number to be en

Develop activation tool for unattend reseal.xml, Project Description: We...

Project Description: We refurbish older computer and send them back into the market with windows 7 operating system. We are presently using windows deployment services through P

Programming, pseudocode for gregorian calendar

pseudocode for gregorian calendar

Command line arguments, i want to check the command line argument is whethe...

i want to check the command line argument is whether an integer or a string

Define structures in c++, Structures A structure is a user-defined data...

Structures A structure is a user-defined data type, which may have different data types as its members. Creating a structure is a two-part process. First, a structure template

D, drawbacks in assignments in engeenirng

drawbacks in assignments in engeenirng

Write a program for simulating jet-powered car acceleration, The absolute l...

The absolute land-speed record of 763.035 MPH (Mach 1.02) was set in October 15 1997 by a jet-powered car called Thrust SSC in the Black Rock Desert of northern Nevada. The team th

Using only arrays, write c program to do the following : -fill 2 dimensiona...

write c program to do the following : -fill 2 dimensional array (square matrix array with size=4). -ask the user to enter any integer number and add this number to the diagonals -o

Explain the function prototype - computer programming, Explain the Function...

Explain the Function Prototype? The Functions must be declared before they are used, ANSI C provides for the new function declaration syntax called as the function prototype,

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