I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com

Valid RSS

get GPL
COST (GBP)
this unit 0.50
sub units 0.50
+
0
ComputingIoBinary

Read File

viewed 11264 times and licensed 119 times
Reads the contents of a file into a dynamically created character string.
Controller: CodeCogs

get GPL add to cart

Dependents

Info

Interface

C++

ReadFile

 
char*readFileFILE*stream )
This function reads the contents of a file into a new, dynamically created, character string of the same length as the file. in the event of an error, this function return a NULL pointer, signalling that no character array was created.

Example:

#include <stdio.h>
#include <codecogs/computing/io/binary/read_file.h>
 
using namespace Computing::IO::Binary;
 
int main ()
{
  FILE* stream = fopen("/Volumes/Data/Components/codecogs/io/binary/read_file.h","rb");
  char* data = readFile(stream);
  printf("\n %s", data);
  fclose(stream);
 
  return 0;
}

Returns

A dynamically allocated string array, containing the file contents

Authors

Will Bateman (March 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.