Reads the contents of a file into a dynamically created character string.
Use the following HTML code to embed the calculators within other websites:
ReadFile
char*readFile(
FILE*
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>usingnamespace 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);
return0;
}
Returns
A dynamically allocated string array, containing the file contents