misc.c:3210: invalid operands to binary +

This is a discussion on misc.c:3210: invalid operands to binary + within the Linux Programming forums, part of the Platform Specific Boards category; Well.... This error is occuring under my linux box, and if anyone has ever tried to compile SWRIP code, they ...

  1. #1
    Unregistered
    Guest

    misc.c:3210: invalid operands to binary +

    Well.... This error is occuring under my linux box, and if anyone has ever tried to compile SWRIP code, they know what I'm talking about...

    Code:
    /* Delete the $~ from the end of the file */
    fgetpos(fp, &pos);
    
    pos += -2; /*This is where there error is! Line 3210 */
    fsetpos(fp, &pos);
    fprintf(fp, "%s~\n",name);
    fprintf(fp, "$~");
    fclose(fp);
    return 1;
    Again, the error is "invalid operands to binary +"

    So what do I do?!?!

    If need be I'll post the file here for you to look at.

    "pos" is an instance of "fpos_t"... "fpos_t" must be in the one of the includer files, because it's not defined anywhere in this code I have...

  2. #2
    Registered User quagsire's Avatar
    Join Date
    Jun 2002
    Posts
    60
    pos += -2; // ????

    try
    pos -= 2;

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,769
    You've assumed fpos_t is an integral type, and in your implementation it isn't

    It should be in stdio.h (I think)

    Perhaps fseek would be better

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. help with this tutorial program: invalid operands to binary( - )
    By convenientstore in forum C Programming
    Replies: 8
    Last Post: 06-08-2009, 01:53 PM
  2. error: invalid operands to binary *
    By cblix in forum C Programming
    Replies: 5
    Last Post: 01-29-2006, 08:45 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  4. Need help with C program
    By ChrisH in forum C Programming
    Replies: 38
    Last Post: 11-13-2004, 01:11 AM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21