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

Can i drop the [] while deleteing array of some built-in , Can I drop the [...

Can I drop the [] while deleteing array of some built-in type (char, int, etc)? A: No. you can't Sometimes programmers think that the [] in the delete[] p only present so the

Assignment, I have an assignment , can I send it

I have an assignment , can I send it

Destruction of array object, What's the order that objects in an array are ...

What's the order that objects in an array are destructed? Need assistance please explain it with example.

Compiler design-limit the methods, Problem : Compiler Design - Limit the me...

Problem : Compiler Design - Limit the methods Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: ·

C program to find area of rectangle, Aim: To implement a program to find a...

Aim: To implement a program to find area of rectangle, surface area of box and volume of box using virtual functions. Code:                       class rect {

Area , Write a program to find the area under the curve y = f(x) between x ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

Calculate the area of circle using c program, Calculate the area of circle ...

Calculate the area of circle using c program: const float Pi = 3.1415926;   inline float area(const float r) {return Pi * r * r;}   main() {    float radius;

Decodethecode, 6999066263304447777077766622337778 -----> message sent by th...

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space". Ex

Word counting, Task Your task is to write a program, words, that reports i...

Task Your task is to write a program, words, that reports information about the number of words read from its standard input. For example, if the file qbf.txtcontains the text th

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