|
|
@ -81,11 +81,11 @@ TQString readfile(const char * filename) {
|
|
|
|
fseek(fp,0,SEEK_END); // Seek to end
|
|
|
|
fseek(fp,0,SEEK_END); // Seek to end
|
|
|
|
len=ftell(fp); // Get position at end (length)
|
|
|
|
len=ftell(fp); // Get position at end (length)
|
|
|
|
fseek(fp,0,SEEK_SET); // Seek to beginning
|
|
|
|
fseek(fp,0,SEEK_SET); // Seek to beginning
|
|
|
|
buf=(char *)malloc(len); // Malloc the buffer
|
|
|
|
buf=(char *)malloc(len+1); // Malloc the buffer
|
|
|
|
fread(buf,len,1,fp); // Read file
|
|
|
|
fread(buf,len,1,fp); // Read file
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
buf[len]=0;
|
|
|
|
buf[len]=0;
|
|
|
|
TQString contents = TQString(buf);
|
|
|
|
TQString contents(buf);
|
|
|
|
free(buf); // Free the buffer
|
|
|
|
free(buf); // Free the buffer
|
|
|
|
return contents;
|
|
|
|
return contents;
|
|
|
|
}
|
|
|
|
}
|
|
|
|