Atropo
10/16/2008 4:42:00 AM
On 15 oct, 21:28, Ian Collins <ian-n...@hotmail.com> wrote:
> Atropo wrote:
> > On 15 oct, 19:52, Ian Collins <ian-n...@hotmail.com> wrote:
> >> std::ostringstream out;
>
> >> out << whatever;
>
> >> system( out.str().c_str() );
>
> *Please* stop quoting signatures!
>
> > Thanks Ian. as I told you I'm on the very beginnings of c++. I
> > included your code but compiler throws error about not function
> > osstringstream defined. what library do i need to include??
>
> You don't include a library, you include a header. osstringstream ind
> declared in <sstream>.
>
> Your C++ book should have told you this, which one are you using?
Actually dont have any. which one would you recommend me?? for free
download of course, maybe you realize by my bad english that english
is not my primary languaje
>
> > meanwhile kept the string var, now it doesn't complaint about
> > asignation and the cout shows well what i want, but not the system
> > call. do i need to include something on the system call
>
> > strt ="date -u "+ strMM+ strDD+ strhh+ strmm+ strAA+ "." + strss +
> > " 2>&1 >/dev/null;";
> > cout << strt;
>
> > system(strt);
>
> Well that's not surprising, is it? You changed the operator.
Well I just use somes examples to twist a bit.
>
> > rtchk2.cpp:62: cannot convert `string' to `const char *' for argument
> > `1' to `system (const char *)'
>
> Very true. Look up std::string's c_str() method. Look up what
> std::osstringstream's str() method returns.
very useful tip, I'm RTFM
I'll give a try to system( strt.c_str() ); I'm just guessing here.
>
> You should do some background reading on strings and iostreams.
>
I know , but when you know nothing, usually don't know what to look
for.
> --
> Ian Collins