Thread: warning

  1. #1
    Registered User
    Join Date
    Apr 2010


    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:
    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", & == NULL) || (fscanf(acc_file,"%d", & == NULL) || 
    					(fscanf(acc_file,"%d", & == NULL))
    					DrawLine(x_start, y_start, x_finish, y_finish, line_colour);

  2. #2
    Registered User
    Join Date
    Sep 2006
    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:

    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
    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, 01: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