Thread: invalid conversion

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    16

    Question invalid conversion

    I am having the same error on 2 parts of my code. i am getting an invalid conversion fron 'int' to 'const char'

    y would i be getting this?

    thanks you

    Black_Solitare

    <code>
    void book::findnme(void) {
    int i;
    int name, result;
    //char temp[20];
    cout << "Finding.." << endl;
    for(i=0;i<MAX;i++) {
    result = strcmp(np[i].name,name);
    if (result == 0)
    cout << "found!" << endl;
    else
    cout << "not found!" << endl;

    }
    }
    </code>

    it is on the result= line

    thanks again.

  2. #2
    Registered User
    Join Date
    May 2004
    Posts
    16
    For some reason, it hasnt seperated the code.

    for this i am sorry

  3. #3
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92
    what is :

    Code:
     np[i].name
    defined as in your code? an int?

    please post the definition of this (data structure?) and maybe i (or others) can help you out.

    oh and use the square brackets [ ] to enclose code, and not the angular brackets < >

  4. #4
    Registered User
    Join Date
    May 2004
    Posts
    16
    ive just noticed that the i has nothing to do with the class that it refers too.... my brains not working anymore...

    i think ive sorted it out! thanks for pointing it out!

    Black_Solitare

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. invalid conversion from `char*' to `char'
    By Tommy7 in forum C++ Programming
    Replies: 3
    Last Post: 06-09-2005, 10:45 PM
  5. Invalid conversion from 'const void*' to 'void*' error
    By prawntoast in forum C Programming
    Replies: 3
    Last Post: 05-01-2005, 10:30 AM