[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  FREAD

  .  Summary

  fread(str <buf>, int <count>, int <fh>);

  .  Description

  The fread function reads up to <count> bytes from the file repre-
  sented by file handle <fh>. Characters are written to the <buf>
  variable, which must be large enough.

  .  Return Value

  The number of bytes actually read is returned, which may be less
  than <count> if an error occurs or and end-of-file is encountered.

  The ferror and feof functions should be used to distinguish an error
  from an end-of-file condition.

  .  Example

  int f;
  str buffer[40];
  f = fopen("test.dat", "r");
  fseek(f, 1000, 0);       // goto offset 1000 in file
  fread(buffer, 40, f);    // and read 40 bytes of data

See Also: ferror feof fopen fclose fwrite fgets fputs fgetc
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson