The string table contains the names of symbols that are too long to inline in the symbol table. To read the string table, position the file pointer just after the symbol table (usually, you read the strings right after you read the symbols anyway), and read four bytes as one 32-bit little endian integer. Allocate this much memory. Set the first four bytes of the memory to zero, and read the remainder of the string table (length-4) into the remainder of the memory (ptr+4). A code sample would look like this:
int i; char *s; read(fd, &i, 4); s = (char *)malloc(i); memset(s, 0, 4); read(fd, s+4, i-4);
All references to strings in this table are offsets from the beginning of this memory block. Note that offsets of zero are legal and will result in a zero-length string because of those four zeros you put at the beginning (where the length used to be).
|webmaster||delorie software privacy|
|Copyright © 2001||Updated Oct 2001|