.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   printf and /" issue (http://forums.bots-united.com/showthread.php?t=1662)

Cpl. Shrike 14-05-2004 17:34

printf and \" issue
 
Howdy,

Im using this line of code in a CGI program this line prints an empty hmtl cell.

Code:

printf ("<TD width=\"40%\">&nbsp;</TD>")
edit/
the & n b s p ; is not showing up between the > < in the code tag
/edit

Well the thing is it compiled and worked fine using GCC on linux
No im trying to compile it in ecpilse work space. as far as i know eclipse just uses the GCC compiler however on build it complains with this message.

Unknown conversion type character `"'
In line 236 ( the line post above)

What confuses me is that it compiles/works on plain gcc and eclipse is complaining. Even while im using the escape char \ before the quote " char.

Is this line of code wrong after all. ?

Whistler 14-05-2004 18:14

Re: printf and /" issue
 
I have compiled that line of code in MSVC and Borland compiler and found no problem.

Cpl. Shrike 14-05-2004 18:29

Re: printf and /" issue
 
:D cool
didn't know about borland , don't have it.

Hmm leaves me with the question why eclipse don't accept it 8o

Cheeseh 14-05-2004 19:18

Re: printf and /" issue
 
could be because of the % sign. I don't even know what the % sign is for printf, because usually putting a % sign denotes that you want to place a variables value here (e.g. %d for an integer) maybe some compilers find it ok, but some dont.

Cpl. Shrike 14-05-2004 21:23

Re: printf and /" issue
 
Ahhh yes i get it... :|
The compiler is expecting a %d or %s etc etc.
It finds %" invalid.

But hmmm it should not take the " because the \ is in front. \"

Or maybe it wants to use the last " sign as an input for the single % sign.

/* think i'll sweep this problem under the eclips rug.

Pierre-Marie Baty 14-05-2004 21:34

Re: printf and /" issue
 
For an ANSI integrist, that line is incorrect.
It should be
Code:

printf ("<TD width=\"40%%\"> </TD>")
because the % character is a special formatting character of printf() itself.

Cpl. Shrike 14-05-2004 22:26

Re: printf and /" issue
 
:D wujo


All times are GMT +2. The time now is 22:39.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.