Search:

Type: Posts; User: freebu

Search: Search took 0.02 seconds.

  1. Replies
    4
    Views
    3,821

    Thanks to all for the suggestions and apologies...

    Thanks to all for the suggestions and apologies for posting c**p code. I didn't want to post hundreds of lines of real code and came up with a buggy example :-(

    The alignment problem looks to be...
  2. Replies
    4
    Views
    3,821

    Sorry - didn't make myself clear enough. ...

    Sorry - didn't make myself clear enough.

    Assume you can't change the code I posted, but I need a pointer to the place in the buffer where the stored struct starts.

    Is this legal ??

    ptr =...
  3. Replies
    4
    Views
    3,821

    Pointer arithmetic

    What's the correct way to do pointer arithmetic in this example ?

    Say I store a struct in a buffer at some offset and then want to get a pointer to it. e.g.




    int offset;
    sometype...
  4. Yeah, fseek() returns 0 (zero) for success and -1...

    Yeah, fseek() returns 0 (zero) for success and -1 on error.

    You *really* should get into the habit of checking return values. Something like:




    if (fseek(fp, 0L, SEEK_SET) != 0) {
    //...
  5. If you're trying to read back what you've just...

    If you're trying to read back what you've just written, you'll have to "rewind" the file pointer first of all.

    After the fprintf(), the file pointer will be positioned at the end-of-file - just...
Results 1 to 5 of 5