casting problem with strcmp command line arg

This is a discussion on casting problem with strcmp command line arg within the C Programming forums, part of the General Programming Boards category; Hey guys i get a type cast error saying passing arg 1 of `strcmp' makes pointer from integer without a ...

  1. #1
    Musicman - Canora
    Join Date
    Aug 2005
    Location
    Melbourne
    Posts
    252

    casting problem with strcmp command line arg

    Hey guys i get a type cast error saying passing arg 1 of `strcmp' makes pointer from integer without a cast.

    Im trying to check whether when passing the command line argument the user has typed in the following

    ./gjc menu submenu

    Code:
    int main(int argc, char *argv[])
    Code:
     if(argc==3 && !strcmp(argv[1], "menu"))
       {
         printf("Cannot find filename wrongly entered\n");
         return ERRORCODE;
       }
    Last edited by bazzano; 04-14-2006 at 02:57 AM.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    are you sure the lines you posted are exactly what the compiler is compiling? There is nothing wrong with what you posted.

  3. #3
    Musicman - Canora
    Join Date
    Aug 2005
    Location
    Melbourne
    Posts
    252
    Thats my make file gjc_options.c gjc_options.h gjc_utility.c gjc_utility.h are all the files i need to make using the make file

    Code:
    #############################################################################
    # 
    # 
    # 
    # 
    # 
    # 
    #
    #
    #############################################################################
    
    # Delete this comment and insert your code here.
    all: gjc.o gjc_utility.o gjc_options.o
    	gcc -gstabs -o gjc gjc.o gjc_utility.o gjc_options.o
    	
    gjc.o: gjc.c gjc.h
    	gcc -gstabs -Wall -ansi -pedantic -c gjc.c
    	
    gjc_options.o: gjc_options.c gjc_options.h
    	gcc -gstabs -Wall -ansi -pedantic -c gjc_options.c
    	
    gjc_utility.o: gjc_utility.c gjc_utility.h
    	gcc -gstabs -Wall -ansi -pedantic -c gjc_utility.c
    	
    clean:
    	rm gjc gjc.o gjc_options.o gjc_utility.o

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Don't cross-post. See my idea in your other thread: http://cboard.cprogramming.com/showt...817#post552817
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with strcmp, beginner>
    By coloughl in forum C Programming
    Replies: 5
    Last Post: 12-12-2001, 02:15 PM
  2. problem with strcmp
    By maditsi in forum C Programming
    Replies: 1
    Last Post: 12-07-2001, 12:38 AM
  3. problem comparing strings with strcmp
    By mikefen in forum C Programming
    Replies: 2
    Last Post: 12-03-2001, 10:45 PM
  4. Problem with Casting.
    By pors7 in forum C++ Programming
    Replies: 2
    Last Post: 11-26-2001, 10:50 AM
  5. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 08:34 PM

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