- When I read small amount ( BytesAmount is small ie : 256, 144, etc ... ) I work perfectly, it read the file content and move in the file so if I do another IDOS->Read file, it will read what follow the latest read in the file
- When I read large amount ( BytesAmount is bigger ie : 24000, 48000, etc ... ) if I do another read, it will read exactly the same area on the file a second time ... the pointer in the file remain at the same place.
Is this normal ? Is there a solution to read step by step a file ( by some sort of hunks ) ?
Regards, AmiDARK.
Edited by freddix on 2010/5/7 15:44:38
All we have to decide is what to do with the time that is given to us.
But I'm not sure to understand ( I'm french and I'm not a perfect english speaking person ;) )
If Actual Length < Length I want it to read, should I recall IDOS->Read function ? With same parameters ? With parameters updated to shift APTR* and Length with the values already read by IDOS ?
Regards, AmiDARK.
All we have to decide is what to do with the time that is given to us.
When you issue the request: Length = IDOS->Read (FileHandle, BufferPtr, MaxBytes),
DOS will read from the current place in the file, a maximum of MaxBytes. It will store what it reads starting at BufferPtr and returns the number of bytes read in Length. It will then increment the current place in the file by Length.
Obviously if it runs into EOF while reading, Length will be less than MaxBytes. If you repeat the request with the same parameters, it will read (or try to) the next MaxBytes from the file and store them at the same place (BufferPtr).
You have to check Length (to see how much it read) and if the result is -1, IoErr() (to see if the Read() ran into EOF).
If you need to repeat a Read(), you will have to call IDOS->ChangeFilePosition() to place the internal read pointer at the proper place.
With this function, is it possible to go forward and backward in the file ?
If you mean the IDOS->ChangeFilePosition(), yes, you can directly set the read pointer anywhere within the file, either as an absolute address or as an offset from the current place.
I will make my own Read function that'll handle all these specificities from IDOS->Read so I will automate the principle to avoid having to handle this in all functions that'll use IDOS->Read function.
[EDIT] I've found the solution. In fact, it did sent error 116 ( Argument missing ) I've checked all info and in fact My memory allocation was not set correctly and pointer was NULL ... that caused IDOS->Read to generate this error.
Now, I've fixed my 3D Object loading function that work perfectly. I'm working on adding limb rotation/position and new texturing.
Kindest Regards, AmiDARK
Edited by freddix on 2010/5/7 15:46:38
All we have to decide is what to do with the time that is given to us.