Parameter | Description |
---|---|
sName | The fully qualified name of the file to read |
iSize (ByRef) | This will return, by reference, the size of the file |
A memory address of a newly created buffer than contains the binary file. It is the developer's responsibility to dispose of the memory when done using it.
Function ReadBinFileToBuffer String sName Integer ByRef iSize Returns Pointer
Call: | Get ReadBinFileToBuffer sName (&iSize) to PointerVariable |
ReadBinFileToBuffer reads a file as binary data from the passed filename. It creates a memory buffer, reads the data into that buffer, returning the buffer address along with its length.
Address aBuffer String sAppSrc sName Integer iBinSize Get psAppSrcPath of (phoWorkspace(ghoApplication)) to sAppSrc Move (sAppSrc +"\Test.exe") to sName // read in a binary file to buffer of size iBinSize Get ReadBinFileToBuffer of oFileHelper sName (&iBinSize) to aBuffer // do whatever you want with the data Send ProcessTheFile aBuffer iBinSize // free the data when you are done Move (Free(aBuffer)) to iVoid
Use WriteBinFileFromBuffer to write a binary file.