Mail Archives: djgpp/1999/09/15/13:33:06
On Mon, 13 Sep 1999, Batchex wrote:
> char **lpszTable;
[snip]
> for(nIdx=1;nIdx<nNumEntries;nIdx++)
> lpszTable[nIdx]=(char *)(lpszTable[0]+(lpszTable[nIdx]-lnDataStart));
[snip]
>
> The last line of the code always gives me "invalid operands for
> binary +".
lpszTable is a pointer to a pointer. Therefore, lpszTable[0] and
(lpszTable[nIdx]-lnDataStart) are both pointers. You cannot add two
pointers in C. That's what the compiler keeps telling you.
> One other question, not related to the above code, anybody know any
> function that can read raw data from file (like _dos_read()) that is
> POSIX compliant? fread() seems to stop whenever it encounter CR/LF
> pair ("\n"), and my data have a lot of them.
Use the "b" specifier when you open the file, like this:
FILE *fp - fopen ("filename", "rb");
And no, _dos_read is not Posix. The DJGPP library docs explicitly
tell which functions are ANSI- and Posix-compliant and which aren't.
Please use that information, it is there for you.
- Raw text -