Advanced input - output routines, C/C++ Programming

Assignment Help:

  Although we can handle most I/O routines with getc and putc , there are file versions of fgets, fputs, fprintf and fscanf . The syntax is
 
    fgets(stringname,n,filename);
 
This reads n-1 characters form the filename into the stringname variable 
  
    fputs(stringname,filename);
 
This writes the contents of the stringname to the filename channel
 
    fscanf(filename,"format",&variables);
 
This is identical to scanf except that the data is read from the filename
 
    fprintf(filename,"format",variables);
 
This is a file write function to store raw binary data
    fwrite(filename,"format",variables);
 
This is a file read function to read raw binary data
 
    fread(filename,"format",variables);

These I/O functions are actually the original I/O functions and printf etc are a simplified sub set of I/O. The VDU and keyboard defined as  streams namely stdout and stdin. Therefore within C we have re-defined the following function i.e

    fprintf(stdout,"format",variables);
 
to
 
    printf("format",variables);
 
Likewise we have 
 
  scanf subset of fscanf    File is stdin
  getchar subset of getc    File is stdin
  putchar subset of putc    File is  stdout
  puts subset of fputs      File is stdout
  gets subset of fgets      File is stdin


Related Discussions:- Advanced input - output routines

C program for sorting, C Program for SORTING # include stdio.h> void...

C Program for SORTING # include stdio.h> void main() {           char a;           int *p;           int i,j,temp;           clrscr();           p=&i;

Recursive function, Write a recursive function recursiveMin that takes an i...

Write a recursive function recursiveMin that takes an integer array, a starting subscript and an ending subscript as arguments, and returns the smallest element in the array. The f

Ice_Cream Game, Do you have any solution on this activity?

Do you have any solution on this activity?

Assignment, (RationalNumber Class) A rational number is a number that can b...

(RationalNumber Class) A rational number is a number that can be represented as the quotient of two integers. For example, 1/3, 5/7, 7/2, and so forth are rational numbers (By 2/1

Define the conditional operator in c language, Define the Conditional Opera...

Define the Conditional Operator in c language? The Simple conditional operator can be carried out with the conditional operators (? And :). An expression that makes use of the

Email system, how to see inbox details of a particular email adress on cons...

how to see inbox details of a particular email adress on console

Symbolic constant, S y m b o li c c o n s t a n t : c ...

S y m b o li c c o n s t a n t : c on s t m a x = 1 0 0 ; T h e d e f a u l t d a t a t y p e w i l l b e i n t e

Program to display asterisks in the shape of a plus sign, Write a program c...

Write a program called plus that will display asterisks in the shape of a plus sign which has the height and width specified by the user. You must only allow entry of an odd numb

Make a connection to fifa ultimate team 14 using c++ or c#, I need to creat...

I need to create a connection to FIFA Ultimate Team 14, I want to utilize C++ specifically for the reason that that is the language I have the most experience in. There are a co

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd