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

Array, If an array holds integer, each of which is four bytes long, how man...

If an array holds integer, each of which is four bytes long, how many bytes from the base location of the array is the location of the fifth element?

Area under curve, Write a program to find the area under the curve y = f(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. The area under a curve between two points can b

C program to create a file student.dat, Program is to create a file student...

Program is to create a file student.dat: Program is to create a file student.dat which contains all name, roll_no,marks(5 sub) and percentage   class student    {

Prime no., program to find if a no . is prime or not

program to find if a no . is prime or not

Binary search tree is constructed by repeatedly, Assume that a Binary Searc...

Assume that a Binary Search Tree is constructed by repeatedly inserting exact values in to the tree. Argue that the number of nodes examined in searching for a value in the tree is

Function, Write a C++ program according to the following specifications 1. ...

Write a C++ program according to the following specifications 1. Display a brief description of the program. 2. Ask the user to specify the type of loading (end load, intermediate

Board coloring , In this problem you are given a board in which some of the...

In this problem you are given a board in which some of the elements are placed as shown in diagram below. Each element represents a color. Fill the other elements in the board, suc

Array of pointers, To write a program to use different levels of array of p...

To write a program to use different levels of array of pointer to pointer & display the output as 1 1 1 2 2 2 3 3 3

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