Welcome to the Builder Academy

Question Warnings compiling with gcc 4.7.2

More
19 Oct 2013 23:54 - 19 Oct 2013 23:56 #4432 by Rumble
Finally getting around to these, but I am going to need some help. The first one I might be missing something is:
Code:
act.wizard.c: In function ‘do_file’: act.wizard.c:4268:10: warning: variable ‘j’ set but not used [-Wunused-but-set-variable] int i, j; /* Generic loop counters. */ ... /* Rename the player's pfile */ sprintf(buf, "mv %s %s", old_pfile, new_pfile); j = system(buf);

Isn't "j = system(buf)" necessary for the sprintf to execute? If so I don't see a way to fix this warning. Or can we just do "system(buf);"?

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com
Last edit: 19 Oct 2013 23:56 by Rumble.

Please Log in or Create an account to join the conversation.

More
20 Oct 2013 09:26 #4433 by thomas
j will contain the return code from the mv, and should really be checked after the call. And get a better name than "j"...

Please Log in or Create an account to join the conversation.

Time to create page: 0.168 seconds