warning

This is a discussion on warning within the C Programming forums, part of the General Programming Boards category; Hello, I am wondering what does this warning actually mean and how can I get rid of it? warning C4047: ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    7

    warning

    Hello,
    I am wondering what does this warning actually mean and how can I get rid of it?

    warning C4047: '==' : 'int' differs in levels of indirection from 'void *'

    This part of code coses the problem. It's looking for the error in the input:
    Code:
    else if (strcmp(str,"LI")==0)
    				{	
    					if ((fscanf(acc_file,"%d", &x_start) == NULL) || (fscanf(acc_file,"%d", &y_start) == NULL) || 
    					(fscanf(acc_file,"%d", &x_finish) == NULL) || (fscanf(acc_file,"%d", &y_finish) == NULL) ||
    					(fscanf(acc_file,"%d", &line_colour.red) == NULL) || (fscanf(acc_file,"%d", &line_colour.green) == NULL) || 
    					(fscanf(acc_file,"%d", &line_colour.blue) == NULL))
    					{
    						c=1;
    						break;
    					}
    					DrawLine(x_start, y_start, x_finish, y_finish, line_colour);
    				}

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Can you post up more of the code?

    That can often be a prototype/return type mismatch, where has int return type indicated, and the other is returning void *.

    I would prefer the if statement to be like this, also:

    Code:
    if (((fscanf(acc_file,"%d", &x_start)) < 1)), etc. note the doubled parenthesis after &x_start
    fscanf() return the number of items stored, which if zero, means an error, and EOF (which is nearly always -1) on end of file.

    You're thinking of fgets(), which returns NULL, but fscanf() doesn't.

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    7
    Thank you very much. That worked for me

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 09-16-2009, 06:00 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. <Gulp>
    By kryptkat in forum Windows Programming
    Replies: 7
    Last Post: 01-14-2006, 12:03 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

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