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

Visual basic, a program to accept average, if average is 75 to 85 print it...

a program to accept average, if average is 75 to 85 print it out else bypass using counter. enter and process 5 records

Strings, A string S is said to be "Super ASCII", if it contains the charact...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

#program, Ask question #Minimum 100 words accepted program for polishin...

Ask question #Minimum 100 words accepted program for polishing jewels#

Program for simple 4-function calculator, Most first graders know that nine...

Most first graders know that nine hundred and ninety nine plus one is one thousand, but C++ doesn't! Sure, a computer can easily compute 999 + 1 and get 1000. But reading and writi

What is an incomplete type in c++, Incomplete types refer to pointers in wh...

Incomplete types refer to pointers in which there is no availability of the execution of the referenced location or it points to some location whose value is not available for modi

Padovan string, A Padovan string P(n) for a natural number n is defined as:...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t

Determine the current flowing in the circuit - voltage, Four cells, each wi...

Four cells, each with an internal resistance of 0.40 ? and an e.m.f. of 2.5 V are connected in series to a load of 38.40 ?. (a) Verify the current flowing in the circuit and t

Explain topologies for the network information system, Problem: a) Give...

Problem: a) Give and Illustrate with the help of diagrams, four topologies for the Network Information System (NIS). b) Give methods for creating user accounts and groups.

Write a program to find files-unix, This programming assignment is for use ...

This programming assignment is for use in the LINUX/UNIX environment!! Introduction: System administration often requires custom written programs and tools. One problem a s

Theory, recursive sub programs

recursive sub programs

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