C প্রোগ্রামিং ও অ্যাডভান্স File অপারেশন

Submitted by tushar pramanick on Mon, 01/02/2012 - 16:39

In last hour's lesson you learned the basics of reading and writing disk data files. In this lesson you'll learn more about communication with disk data files. The main topics discussed in this hour are

    Random access to files
    Reading or writing binary data
    Redirecting the standard streams

In addition, the following C I/O functions are introduced in this lesson:

    The fseek(), ftell(), and rewind() functions
    The fscanf() and fprintf() functions
    The freopen() function




Summary

  •     The file position indicator can be reset by the fseek() function.
  •     The ftell() function can tell you the value of the current file position indicator.
  •     The rewind() function can set the file position indicator to the beginning of a file.
  •     After you specify the mode of the fopen() function for the binary file, you can use the fread() or fwrite() functions to perform I/O operations on binary data.
  •     Besides the fact that the fscanf() and fprintf() functions can do the same jobs as the scanf() and printf() functions, the fscanf() and fprintf() functions also allow the programmer to specify I/O streams.
  •     You can redirect the standard streams, such as stdin and stdout, to a disk file with the help of the freopen() function.

 

Related Items

The if-else Statement

The if-else Statement

The if statement

The if statement

If life were a straight line, it would be very boring. The same thing is true for programming. It would be too dull if the statements in your program could only be executed in the order in which they appear.

Mathematical Functions in C

Mathematical Functions in C

Basically, the math functions provided by the C language can be classified into three groups:

    Trigonometric and hyperbolic functions, such as acos(), cos(), and cosh().

Changing Data Sizes

Changing Data Sizes

Enabling or Disabling the Sign Bit

Enabling or Disabling the Sign Bit

As you know, it's very easy to express a negative number in decimal. All you need to do is put a minus sign in front of the absolute value of the number. But how does the computer represent a negative number in the binary format?