Error Cannot Convert Parameter 1

This is a discussion on Error Cannot Convert Parameter 1 within the C++ Programming forums, part of the General Programming Boards category; rply to lightatdown: it crashes before it even gets to there at the call of geline....

  1. #46
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669
    rply to lightatdown: it crashes before it even gets to there at the call of geline.

  2. #47
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,088
    I haven't studied this whole thread (or the one before it) completely, but just looking at the code you just posted, here is what you must do to get it working:
    [list=1][*]Change char *programs[30]; to char *programs[31]; or change all of your loops to stop at < 30 instead of <= 30. This is your crash.[*]Remove delete [] *programs; That will cause a crash also. The programs array was not allocated with new.[*]When you loop through programs and delete the char* strings, you must use delete [] programs[lp]; That is because all 30 (or 31) entries in the programs array are char arrays allocated with new [], so they must be deleted with delete [].[*]Now that your program doesn't crash, it doesn't do what you want because by using get you never get past the first word. You should probably do as others suggested with getline, but specifically for the code you last posted you can add the following:
    Code:
    char temp[2];
    data.get(temp,2);
    after you get the word into programs. I don't know why you need to do it that way, and I'm not sure that is the right way to fix your problem, but it worked for me.[/list=1]

  3. #48
    Student drdroid's Avatar
    Join Date
    Feb 2002
    Location
    Montreal, Quebec
    Posts
    669

    ...

    ECCP1... It's made you laugh, it's made you cry... it's made you want to beat the living $$$$ out of drdroid.... and finally as the last episode comes to an end... you'll be guessing until the end.

    Ok, here goes... the last problem was... ::drum rooolll:: a couple things... the delete couldn't delete an empty char, it seemed to have a problem with that... and the loops were to big... besides destroying them... after page 3.5 the problem was pretty much solved...

    The... end....

    ?

    edit: but theres one.. major TWIST!!! SOMEONE MUST DIE!!!!
    edit: LOOK OUT BEHIND YOU!!! ::screams:: ::bang:: NOOOOO!!!!
    ::sad piano music plays in the background... credits roll::

    Thanks Salem, Lasunde, Jlou, Lightatdawn and Cat... this has really made me look back at everything to learn every detail... not that I'm going to drop this project... I learned alot... thanks again.

    really.. this time...
    THE END
    Last edited by drdroid; 08-01-2003 at 09:04 PM.

Page 4 of 4 FirstFirst 1234
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-08-2008, 05:31 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. cannot start a parameter declaration
    By Dark Nemesis in forum C++ Programming
    Replies: 6
    Last Post: 09-23-2005, 02:09 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM

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