[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [help-cgicc] Data Casting
From: |
Stephen F. Booth |
Subject: |
RE: [help-cgicc] Data Casting |
Date: |
Fri, 11 Jul 2003 09:30:31 -0400 |
I guess you shouldn't pass a string object to a c function with varargs.
Use the c_str() function to get the data you want:
sprintf(prog,
"lpr -P%s /tmp/print_web.tmp",prg_prn_sel->getValue().c_str());
> -----Original Message-----
> From: address@hidden [mailto:help-cgicc-
> address@hidden On Behalf Of Marcos Araujo Sobrinho
> Sent: Tuesday, February 25, 2003 11:28 AM
> To: address@hidden
> Subject: [help-cgicc] Data Casting
>
> Hi,
>
> First, sorry about my poor english.
>
>
> I'm newbie in cgicc and i'm having some troubles with it.
>
> I need to receive a value from a form, and then, call a system() with
> it.
>
> ofstream print_tmp("/tmp/print_web.tmp");
> (*prg_arquivo).writeToStream(print_tmp);
> char prog[500];
> sprintf(prog, "lpr -P%s /tmp/print_web.tmp",prg_prn_sel->getValue());
> system(prog);
>
> but when I try to compile, i'm getting this:
>
> webprint.cpp: In function `int main(int, char **)':
> webprint.cpp:60: warning: cannot pass objects of type `string' through
> `...'
>
> and when I run the program i'm getting this:
>
> lpr -Pxôëô8úØúP /tmp/print_web.tmp
>
>
> What I can do to fix this?
>
> Thanks for help, and again, sorry about my very bad english
> Marcos
>
>
>
> _______________________________________________
> help-cgicc mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/help-cgicc