|
From: <a_g...@ya...> - 2003-06-12 13:18:28
|
Looks like a bug with g_print when too many formtters are used :-). Thanks for telling that, I will be carefull in the future.
Fernando_Conceição <fer...@te...> wrote:Thanks, this works fine!
My problem really was not with sprintf at last, i was using g_print()
from gtk to show this(is a graphical application, only to debug) and
with it I get an error.
Using your sample(changing puts by g_print) too gives an error but now i
do with puts and appear exactly I want.
Avik Ghose escreveu:
> This one works!!
>
> #include
> #include
> #include
> int main()
> {
> char sql_lt[128] = {'\0'};
> char *prcampo = "hello";
> char *prprocurar = "world";
> sprintf(sql_lt,"select data,titulo,categoria,anotacao, \
> ROWID from anot where %s like \'%%%s%%\';",prcampo,prprocurar);
> puts(sql_lt);
> return 0;
> }/*main*/
>
>
> Fernando_Conceição wrote:
>
> Hi! In this:
> sprintf(sql_lt,"select data,titulo,categoria,anotacao,ROWID from anot
> where %s like '%s';",prcampo,prprocurar);
> I get something like this:
> select data,titulo,categoria,anotacao,ROWID from anot where titulo
> like
> 'mytitle';
> But when I try place a % there is an error, or the value appears
> wrong
> or I get a NULL string, by example, I need this output
> select data,titulo,categoria,anotacao,ROWID from anot where titulo
> like
> '%mytitle%';
> I try to place one %, two %(like tell in libc reference), \% and
> nothing
> gives what I want.
> Can you show me how to do this?
>
> Thanks.
>
>
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: eBay
> Great deals on office technology -- on eBay now! Click here:
> http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
>
> Thanx and Regards
> Avik Ghose
>
> Catch all the cricket action. Download Yahoo! Score tracker
>
>
Thanx and Regards
Avik Ghose
Catch all the cricket action. Download Yahoo! Score tracker |