[Qt-interest] QFile and fread from resource
Oliver Demetz
forenbeitraege at oliverdemetz.de
Thu Nov 5 13:04:12 CET 2009
Hi!
Up to now I am writing and reading a data file from the filesystem via
//write
int xea[10];
FILE * f = fopen("file.dat","wb");
fwrite(xea, sizeof(int), 10, f);
unsigned char byte;
byte = (unsigned char)( 15 ) );
fwrite(&byte, sizeof(unsigned char), 1, f);
//read
int xea[10];
FILE * f = fopen("file.dat","rb");
fread(xea, sizeof(int), 10, resfile)
unsigned char byte;
byte = getc(f);
This works. If possible, I don't want to change this.
I just want to move the data file into the resource file system of my
executable (of course just for reading).
does
> fopen(":/file.dat", rb) work?
I looked into QFile and QDataStream, but there is no
fread(void* data, size_t element_size, int num, FILE * f)
function which allows me to read an array of int's as I am doing (which
is really comfortable).
Thanks in advance
Olli
More information about the Qt-interest-old
mailing list