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

Another Function for Writing: putchar()

Another Function for Writing: putchar()

C প্রোগ্রামিং এর putc() Function এর ব্যবহার

Using the putc() Function
The putc() function writes a character to the specified file stream, which, in our case, is the standard output pointing to your screen.

 

C প্রোগ্রামিংয়ের getchar() Function এর ব্যবহার

Using the getchar() Function
The C language provides another function, getchar(), to perform a similar operation to getc(). More precisely, the getchar() function is equivalent to getc(stdin).

 

The syntax for the getchar() function is

 

C প্রোগ্রামিংয়ে getc() Function এর ব্যবহার

Using the getc() Function
The getc() function reads the next character from a file stream, and returns the character as an integer.

 

The syntax for the getc() function is

 

C প্রোগ্রামিং এর double Data Type সম্পর্কে আলোচনা

The double Data Type
In the C language, a floating-point number can also be represented by another data type, called the double data type. In other words, you can specify a variable by the double keyword, and assign the variable a floating-point number.