>I have a question about processing binary file with Foxpro.
>Foxpro provides some functions, like fread(), for reading
>binary files. However, it seems that these functions assume
>the input data as strings. So if the data input from the
>binary file is actually integers or float numbers, how can I
>do?
You'll have to provide functions for that. Reading integers should be easy. Here is an example (assuming little endian integers):
FUNCTION GetInt16
LPARAMETER nFile, nOffset
LOCAL lnHigh, lnLow
IF PCOUNT()=2
FSEEK(nFile,nOffset,0)
ENDIF
lnLow = ASC(FREAD(nFile,1))
lnHigh = ASC(FREAD(nFile,1))
RETURN lnHigh*0x100+lnLow
32 bits and signed integers handling can go from here.
There are many float numbers formats, it will not be an easy task unless you find a suitable function for the format you must take care of.
----------------------------------
António Tavares Lopes