Thread: Error Cannot Convert Parameter 1

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

    ...

    No, that's to easy... besides how will I learn pointers if I don't use them.
    Last edited by drdroid; 08-01-2003 at 06:38 AM.

  2. #17
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    This thread is hilarious!!!!!!!!!!

    I'm sure this has all been pointed out already, but here's another try.

    > for(int lp=0;lp!=30;lp++)
    This should be:
    for(int lp=0;lp<30;lp++)

    > data.get(*programs[lp]);
    Try getline() and take off the star:
    data.getline(programs[lp],21);

    > strcpy(programs[lp],&"EMPTYSLOT ");
    This should be:
    strcpy(programs[lp],"EMPTYSLOT ");

    > cout << *programs[1];

    This should be:
    cout << programs[1];
    Or if you want the first string:
    cout << programs[0];
    Last edited by swoopy; 07-31-2003 at 07:10 PM.

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

    swoopy

    all of that's already in the program... and I dun want getline, I'm doing word by word not line by line. Nothing has been solved.

  4. #19
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Since nothing here seems to be helping you maybe look at this link it helped me to understand pointers...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

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

    ...

    I haven't seen any problems with my POINTERS THAT'S THE PROBLEM... FWOIIII... sorry, excuse my outburst. But seriously, i know pointers, i just don't know what's wrong, i never stated that my problem was with my pointers, I've done everything you've told me to and it hasn't helped.

    edit: so I'm going to erase anything having to do with that god damn variable and I'm going to start from god damn scratch.

  6. #21
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    seriously, it's good to try challenging things to help you learn, but I think you're out of your depth on this one Dr. Droid.
    You don't seem prepared to listen to people's advice anyway
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  7. #22
    Registered User
    Join Date
    May 2003
    Posts
    1,619
    Why don't you post your code (without ANY type casts), highlight each line (use [ color=red ] and [ /color ] tags to highlight a line) that gives a compilation error, and explain in words what each variable is supposed to be and what the goal of the program is.

    Without knowing what you're trying to accomplish, how are we to know how to advise? For example:

    char* programs[30][21];

    This creates 630 pointers (presumably for strings of some kind) but allocates no memory for the strings themselves. Were you trying to allocate memory for 30 strings that are 21 characters long? That isn't what happened.

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

    ...

    I've narrowed all of the errors down to mainly this:

    Code:
    &data.get(programs[lp]);
    
    &data.get(programs[lp],20);
    with and without the & before data. And about that other stuff was; how else was I going to practice pointers :p .

    seriously, it's good to try challenging things to help you learn, but I think you're out of your depth on this one Dr. Droid.
    You don't seem prepared to listen to people's advice anyway
    what makes you think that? I've tried everything that's been posted here. Despite what you may think I have, and even read that thing on pointers. I understand pointers in concept, and I think I know them in syntax... I've tried going through it to make sure there was a pointer, "pointee", a refrence etc.

    Heres the code now:

    Code:
    #include <iostream> 
    #include <fstream> 
    #include <conio.h>
    
    using namespace std;
    
    char proglist[31][21];
    char (*programs)[31][21];
    
    bool charcheck(char* first, char* second)
    {
    	bool success=true;
    	int lp=0;
    	for(;;)
    	{
    		if(first[lp]!=second[lp])
    		{	
    			success=false;
    			break;
    		}
    		else if(first[lp]=='\0' && second[lp]!='\0')
    		{
    			success=false;
    			break;
    		}
    		else if(first[lp]!='\0'&& second[lp]=='\0')
    		{
    			success=false;
    			break;
    		}
    		else if(success==true && first[lp]=='\0' && second[lp]=='\0')
    		{
    			break;
    		}
    		lp++;
    	}
    	return success;
    }
    
    int main()
    {
    	programs=&proglist;
    	ifstream data("proglist.txt");
    	for(int lp=0;lp<=30;lp++)
    	{
    		&data.get(programs[lp][0],20);
    		if(charcheck(programs[lp][0]," ")==true)
    		{
    			cout << "test";
    			strcpy(programs[lp][0],&"EMPTYSLOT ");
    		}
    	}
    	data.close();
    	cout << programs[1];
    	getch();
    	return 0;
    }
    Last edited by drdroid; 08-01-2003 at 07:07 AM.

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

    ...

    With that, now I'm starting to get that it's performing illegal operations.

    Edit:
    COREWARS caused an invalid page fault in
    module COREWARS.EXE at 0167:00404899.
    Registers:
    EAX=006bfdb8 CS=0167 EIP=00404899 EFLGS=00010246
    EBX=005b0000 SS=016f ESP=006bfc04 EBP=006bfc94
    ECX=0048111f DS=016f ESI=8196900c FS=20e7
    EDX=006bfdb8 ES=016f EDI=006bfc84 GS=0000
    Bytes at CS:EIP:
    c6 01 00 8b 45 ec 8b 4d f4 64 89 0d 00 00 00 00
    Stack dump:
    006bfcf8 8196900c 005b0000 cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc cccccccc

    Edit2: BTW, i changed the latest sourcecode on page 2.

  10. #25
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    I'll echo what Salem said above.
    Please describe in words what you want to happen. For instance, do you want to read the file char by char and place a pointer to each char or line by line or ... ?
    Also please add part or all of the file "proglist".

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

    ...

    Well, I used error flagging and found that it got all the way to here and then crashed.

    for(int lp=0;lp<=30;lp++)
    {
    &data.get(programs[lp][0],20);
    if(charcheck(programs[lp][0]," ")==true)
    {
    cout << "test";
    strcpy(programs[lp][0],&"EMPTYSLOT ");
    }
    HERE
    }
    data.close();

    edit: and this is the file... btw, I'm changing the code on page two again.


    Code:
    this is a test
    Lol, i plan on changing the file once I get everythign running. Basically what I'm doing is loading a file that lists words, I'm loading thoughs words into an array(proglist) which I am pointing to with *program.
    Last edited by drdroid; 08-01-2003 at 07:06 AM.

  12. #27
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Basically what I'm doing is loading a file that lists words, I'm loading thoughs words into an array(proglist) which I am pointing to with *program.
    A bit vauge description.

    If the contest of your file is

    Code:
    this is a test
    Do you want one pointer to "this", another pointer to "is" etc... or do you want one pointer to 't' then another to 'h' and 'i' and 's' etc ? Im still not totally getting this...

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

    ...

    I loop through the array, that part of the array takes this, the next part of the array takes is the next part takes a and the next part takes test. Before all of that I create a pointer and the array, then I make a refrence from the pointer to the array.

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

    ...

    you repeatedly make the same mistakes and basically ignore everything everyone says
    I just reread the entire thread for the 3rd or 4rth time and I've done everything you've told me to except forget about the pointers and do it another way.

  15. #30
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    take it easy on the little guy. he's just a kid
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-08-2008, 06: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