You must be logged in to do that.

FileWriteQuad

FileWriteQuad
void FileWriteQuad(int file, int quad)

Documentation

Pass a handle to a file that is opened in write mode, and an integer to be written. Four bytes will be written at the current position within the file, over any data that was previously there, and position will move to the next byte. As this writes the full value of the verge integer, it will read back exactly as it was stored.

Note that the bytes are stored in order of least significant to most significant. In effect what happens is:

FileWriteByte(quad & 255);
FileWriteByte(quad & (255 << 8));
FileWriteByte(quad & (255 << 16));
FileWriteByte(quad & (255 << 24));

Example Usage

int file = FileOpen("datafile.txt", FILE_WRITE);
FileWriteQuad(file, 97); // or $61 or 'a'
FileClose(file);
// Opens/Creats a file and writes four byte to it
// Opened in a hex editor gives '61 00 00 00'

int file = FileOpen("datafile.txt", FILE_WRITE);
FileWriteQuad(file, -2);
FileClose(file);
// All integers are stored in full
// -2 in binary: 11111111111111111111111111111110
// File opened in a hex editor gives 'fe ff ff ff'
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.