• C

Compile errors...

Could you please let me know ho to fix this error...

386: fprintf(fp, "\t<command cmd=/"%s/">\n", command);

file should contain this  -> <command cmd=”authorizationFailure” >   

simba.c:386: `s' undeclared (first use in this function)
simba.c:386: (Each undeclared identifier is reported only once
simba.c:386: for each function it appears in.)
make: *** [simba.o] Error 1


     
sudarshantkAsked:
Who is Participating?
 
cwwkieConnect With a Mentor Commented:
>> 386: fprintf(fp, "\t<command cmd=/"%s/">\n", command);

use a backslash to escape the quote:

386: fprintf(fp, "\t<command cmd=\"%s\">\n", command);
0
 
nafis_devlprCommented:
the above solution is alright, you can also try this

fprintf(fp, "\t<command cmd=%c%s%c>\n",'\"', '\"', command);
0
 
cwwkieCommented:
>> fprintf(fp, "\t<command cmd=%c%s%c>\n",'\"', '\"', command);

only when you put the arguments in the right order ;-)

fprintf(fp, "\t<command cmd=%c%s%c>\n", '\"', command, '\"');
0
 
nafis_devlprCommented:
yeah you are right buddy, sorry, it should be like this

fprintf(fp, "\t<command cmd=%c%s%c>\n", '\"', command, '\"');
0
 
cupCommented:
Alternatively if you are working in ASCII (solution may be different if you are working in EBCDIC)

fprintf(fp, "\t<command cmd=\042%s\042>\n", command);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.