If dest is a character array, the file will be read as raw binary data and the return value reflects the number of bytes read into the character array (which is equal to the file size).
If dest is a string array, the file will be read as a text file (one line per array member) and the return value will be the number of lines read into the string array. Newline characters will be stripped.
If dest is a string, the entire file will be read into that string and the return value will be the length of that string (which is not necessarily equal to the file size, if the operating system stores text files with "cr/lf" instead of a "newline" character).
Example
char b[]; int nBytes = fileread(b, "data.bin"); string lines[]; int nLines = fileread(lines, "data.txt"); string text; int nChars = fileread(text, "data.txt");
Index | Copyright © 2005 CadSoft Computer GmbH |