FUNCTION
Read_File
Reads the contents of a file into a dynamically created character string.
You're viewing an older version of this page (#5331). View the current version.
Interface
#include <codecogs/computing/io/binary/read_file.h>
using namespace Computing::Io::Binary;
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("/codecogs/computing/io/binary/read_file.h","rb");
char* data = readFile(stream);
printf("\n %s", data);
fclose(stream);
return 0;
}
Parameters
stream
A pointer to the file stream
Returns
A dynamically allocated string array, containing the file contents
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.