Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trying to use fread/fseek
#2
Use "rb" mode. That is, binary. By default, file is opened in text mode, where some characters are translated (eg \n to \r\n).

,,int* inFile = +fopen(fname, "rb")

You can also use File class. It wraps fopen and similar functions. Example:

Code:
Copy      Help
dll ws2_32 #ntohl ntohlVar

File f.Open(fname "r") ;;Open appends b
f.SetPos(96)
f.Read(&tempInt 1 4)
;mes(tempInt "" "")
magNum = ntohl(tempInt);
mes(magNum "" "")


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)