You must be logged in to do that.

FileReadWord

FileReadWord
int FileReadWord(int file)

Documentation

Pass a handle to a file opened in read mode, and returns the integer value of the first two bytes at the current position, and moves the position onto the following byte. The returned number will always between 0 to 65535. The least significant byte is read in first, so effectively performing:

FileReadByte(file) + (FileReadByte(file) << 8)

Example Usage

int file = FileOpen("readme.txt", FILE_READ);
Log(str(FileReadWord(file)));
FileClose(file);
// This read the first two bytes and logs the value
// First line is "Welcome to VERGE 3! " so logs
// The number '25943' which is the value of 'W' in ascii
// plus the value of 'e' raised by one byte
// 87 + (101 << 8)== 87 + 25856 == 25943
// Obviously this is more useful as a big number
Talkback

There are no talkbacks on this documentation page yet. Post the first?

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.