Thread: Fread
View Single Post
Old Dec 16th, 2004, 12:50 PM   #1
saxman
Newbie
 
Join Date: Dec 2004
Posts: 7
Rep Power: 0 saxman is on a distinguished road
I'm calling the FREAD function in assembly, but I have an issue. This is what I'm trying to accomplish:

unsigned short int * *value1;
unsigned short int * *value2;
unsigned short int * *value3;
unsigned short int * *value4;
FILE * **GSShandle

// ~~ cut out some code to show you what I'm looking at ~~ //

fread(&value1, sizeof(short int), 1, GSShandle);
fread(&value2, sizeof(short int), 1, GSShandle);
fread(&value3, sizeof(short int), 1, GSShandle);
fread(&value4, sizeof(short int), 1, GSShandle);

As you can see, the valueX variables are defined one after another. In theory, I would believe that I could use a single FREAD and write to all 4. This is what I put into ASM:

push * *ebx * * * * * *;I had put GSShandle here prior to this code
push * *4 * * * * * * *;4 values
push * *2 * * * * * * *;Define each value as 'WORD' size
push * *offset value1 *;Set the offset to 'VALUE1'
call * *fseek * * * * *;Do it's thing
add * * esp, 10h * * *;Fix our stack

When I try it, the results are not what I thought they would be. I am having a pretty difficult time debugging this and seeing what it's 'actually' doing. I was wondering if anyone had any clue as to why my ASM code doesn't work. I realize I could do each of the 4 FREAD's, but I thought it'd be neat to do all 4 in 1 shot.



EDIT: Perhaps this belongs in the C forum instead of this one. I guess I put it here since I was experimenting with the function in assembly... would it be too much trouble if this was moved to C? I think my chances of getting a reply would increase!
saxman is offline   Reply With Quote