What is meant by opening a data file
A data file is a file that can be read from or written to. Data files are particularly useful when large amounts of data are involved. Each line of a data file is called a record. The following is the first few records of the file ospots.dat (a file containing the total number of sunspots observed in a year during the years 1850-1975):
1850 66.6
1851 64.5
1852 54.1
1853 39.0
1854 20.6
To read from or write to a data file during the execution of a program, the file must first be opened with the function "fopen". This function takes two arguments - the first one is the path to your file, including the filename. So if your file sits in the same directory as your C source file, you can simply enter the filename in here . The second argument is another char *, and determines how the file is opened by your program. Finally, fopen returns a FILE pointer if the file was opened successfully, else it returns NULL.