bytes into integer, need help

James james at gmail.com
Wed Nov 5 22:37:31 PST 2008


im having problem in code below, while making my own file handler. the data stored in buffer, so i can recall portion of data in diff format and length like int,short,etc.  but im stuck with function getb() below. any suggestion? thks.

struct T_FILE_RAM {
  ubyte[] buffer;
  int offset;

void getb(void* buf, int size) {
	buf=&b[offset..offset+size]; //<-- prob here
}

void read(out uint x) { getb(&x, x.sizeof); }
void read(out ushort x) { getb(&x, x.sizeof); }

}


More information about the Digitalmars-d-learn mailing list