In this program I would like to show you how to store your output file .
we can get output file in any format in order to use it for further use.
/* program for an output file */
#include<stdio.h>
int main()
{
int i, j ;
FILE *fp ; //specific pointer which stores data and transfer it to output file //
fp= fopen("Output.xslx","w");
/* fopen creates a file if it is not already created otherwise overwrites it depends on the mode . " Output.xslx " is output file name ,it could be anything and any format , "w" stands for writing mode in order to write into file , in order to read from file we use "r" */
for(i=0;i<=10;i++)
{
j=i+2;
fprintf(fp, "%d %d\n", i , j);
// fprintf is used to print output in the file ,just like normal printf with pointer's name //
}
fclose(fp); // in order to close the file //
return 0;
}
we can get output file in any format in order to use it for further use.
/* program for an output file */
#include<stdio.h>
int main()
{
int i, j ;
FILE *fp ; //specific pointer which stores data and transfer it to output file //
fp= fopen("Output.xslx","w");
/* fopen creates a file if it is not already created otherwise overwrites it depends on the mode . " Output.xslx " is output file name ,it could be anything and any format , "w" stands for writing mode in order to write into file , in order to read from file we use "r" */
for(i=0;i<=10;i++)
{
j=i+2;
fprintf(fp, "%d %d\n", i , j);
// fprintf is used to print output in the file ,just like normal printf with pointer's name //
}
fclose(fp); // in order to close the file //
return 0;
}
No comments:
Post a Comment