From the course: C: Data Structures, Pointers, and File Systems

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Working with raw data

Working with raw data - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

Working with raw data

- [Instructor] The file versions of the standard CIO functions write text. To read and write raw data, you use the F read and F write functions. and closing functions remain the same. So, in this exercise file, 10 integers are written to the file integers.dat, which is created as a string constant at line five. Then at line 10, the files open for writing using the standard F open function with W as the mode. A loop at line 19 writes the 10 integers. The the F write statement at line 21 consumes four arguments. The first is the address of the variable that contains the value to write. In this case, it's variable A initialized at line 18, and then incremented by five in line 22 each time the loop spins. The second argument is the size of the data chunk to write. I use the size of operator on an integer to obtain that size. The third argument is the number of chunks to write, one in this case, one integer, and the fourth argument is the file handle, build and run. The code has no…

Contents