General information
Category:
Coding, syntax & commands
Title:
Getting Hex data out of a file into a string
I'm trying to get the size of a image file using the bytes in the header. What I can't seem to negotiate is that fgets() translates the bytes it pulls from the file into their ASCII equivalent.
I just want the the hex values because I need to swap an upper and lower byte (endianess?) before doing evaluate("0x" + hex_size). In C/C++ you can change the stream extraction type or cast the extracted values. Can Foxpro do something like this, so that hex values can be extracted from a file?
Also, " alltrim(str(asc(fgets(file_handle,1)))) " doesn't work because when hex A-F appear, fgets doesn't convert them to a valid ASCII character and then " alltrim(str(asc( " won't work correctly. Thanks in advance.
-Josh
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only