I have function that is supposed to make my life a little easier. It reads a file and returns it as a string.
It works out great if you give it a text file, though I might not always handle text files. This is where the problem is. I'm actually trying to revise my sound encryption system, this time, I'm encrypting them in memory, rather than to disk, such that they can be written to a pack file, to eliminate the extra step of opening that encrypted file on disk then putting it into the pack file.
With ogg vorbis files in particular, it peeks the first 4 or 6 bytes to string, then promptly stops, which gives me an incomplete result and i can't use that with the AES encoder.
Here is what I have as of now, just the file reading section.
Code: Select all
Procedure.s read_file(inpt.s)
ReadFile(0, inpt)
*buffer=AllocateMemory(Lof(0))
ReadData(0, *buffer, Lof(0))
If Eof(0)=1
CloseFile(0)
EndIf
f.s=PeekS(*buffer, MemorySize(*buffer), #PB_Ascii)
Debug("Returning "+Str(StringByteLength(f)))
FreeMemory(*buffer)
ProcedureReturn f
EndProcedure
Anyone have any ideas?