#include <stdio.h>
int main(void)
{
FILE *fp; // first establish a pointer to a
FILE
int i;
float x ;
fp = fopen ("/home/cpgms/zero2nine" , "w" ) ;
//second assogn a filename and read or write type to a disk file and
point fp to it
for( i=0; i <10; i++)
{
x = i ;
fprintf (fp,"%f \n",x); /// now put data in the
file pointed to by fp
}
fclose(fp); ///// important do not forget to
close the file
return 0 ;
}
Return to previous page