What do these Errors mean?

This is a discussion on What do these Errors mean? within the C++ Programming forums, part of the General Programming Boards category; I am using VC++ 6.0 and do not understand what these errors mean. Could someone please tell me what they ...

  1. #1
    Tragen
    Guest

    Question What do these Errors mean?

    I am using VC++ 6.0 and do not understand what these errors mean. Could someone please tell me what they mean. Also, since I doubt anyone wants to read 600 lines of code I'll post the part I'm getting the errors on (let me know if more code needs to be posted).

    temp is being used again and again, that is why it is so big and ds_entry is of course a dynamacally allocated structure.

    Code:
    char temp[500];
    
    cout << "Complete...(y) or (n): ";
    cin.get(temp, 500, '\n');
    cin.ignore(100, '\n');
    while(!(temp == 'y' || temp == 'Y' || temp == 'n' || temp == 'N'))
    {
         strcpy(temp, " ");
         cout << "Please enter (y) or (n): ";
         cin.get(temp, '\n');
         cin.ignore(100, '\n');
         cout << endl;
    }
    ds_entry[eNumber]->complete = new char[strlen(temp) + 1];
    strcpy(ds_entry[eNumber]->complete, temp);
    strcpy(temp, " ");
    cout << endl;
    The errors I get are

    --------------------Configuration: LongShot - Win32 Debug--------------------
    Compiling...
    dseen.cpp
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2446: '==' : no conversion from 'int' to 'char *'
    Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2040: '==' : 'char [500]' differs in levels of indirection from 'int'
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2446: '==' : no conversion from 'int' to 'char *'
    Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2040: '==' : 'char [500]' differs in levels of indirection from 'int'
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2446: '==' : no conversion from 'int' to 'char *'
    Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2040: '==' : 'char [500]' differs in levels of indirection from 'int'
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2446: '==' : no conversion from 'int' to 'char *'
    Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    C:\Program Files\Microsoft Visual Studio\MyProjects\LongShot\dseen.cpp(218) : error C2040: '==' : 'char [500]' differs in levels of indirection from 'int'
    Error executing cl.exe.

    dseen.obj - 8 error(s), 0 warning(s)

    -----------------------------------------------------------------------

    They refer to the temp variable but I do not know how to correct this. What is going on and what is the int in the errors?

  2. #2
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    Try using a different value rather than temp, like char TEMP. See if that works, because at one stage you are checking to see if 'temp' if equal to a char, so if temp is an array of char you'd probably get an error. In another place though your trying to copy a string (" ") to temp. If temp is a single char then you would just be able to write temp = ' '. If temp is a string though, then you will have to compare it like this
    Code:
    if(temp[0] == 'y' ...)
    It looks like your getting more error than this, but they were the ones I noticed straight out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 04:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 11:50 AM
  3. Unknown Errors in simple program
    By neandrake in forum C++ Programming
    Replies: 16
    Last Post: 04-06-2004, 03:57 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. errors in class(urgent)
    By ayesha in forum C++ Programming
    Replies: 2
    Last Post: 11-10-2001, 06:51 PM

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