"R. Stormo" <anti_rohnny@spam_stormweb.no> wrote in message
news:qEhEd.81846$Vf.3695005@news000.worldonline.dk ...[color=blue]
> Mike Wahler wrote:
>[color=green]
> >[/color]
>[color=green]
> >
> > There's no function 'msgbox()' in standard C. If it's your
> > function, you need to show its definition. OTherwise when
> > posting here, use a standard function, e.g.:[/color]
> The messagebox.c
> void msgbox(char *mytekst, char *mytitle)
> {
> eMessageBox msg(mytekst, mytitle,[/color]
eMessageBox::iconInfo|eMessageBox::btOK);[color=blue]
> msg.show(); msg.exec(); msg.hide();
> }
>
> there is not here the problem is.
>
>[color=green]
> >
> > puts("could not open file to read !!!");
> >[color=darkred]
> >> else
> >> {
> >> while( !feof( fp ) ) //check for EOF[/color]
> >
> > You're using 'feof()' incorrectly. See the C FAQ for details.
> >[color=darkred]
> >> {
> >> fgets( line, 128, fp ); //Read 128 bytes[/color]
> >
> > You should check the return value of 'fgets()' to see if
> > an error occurred.
> >[color=darkred]
> >> strcat( message, line ); //Add this line to previous buffer[/color]
> >
> > 'strcat()' will attempt to evaluate the value of the first
> > character of the array 'message'. Since it has never been
> > initialized or given a valid value, this produces undefined
> > behavior.[/color]
> thanks for info. As I have heard this is not the right way to execute a
> script either.[/color]
Standard C++ has no notion of 'scripts', so does not
say anything about how to use them 'correctly'.
[color=blue]
> But it does work. But it do only show the text that are
> written by echo and not what a command that are executeed within the[/color]
script[color=blue]
> are printing out.
>
> If my script are like this.
> echo "telnet test"
> telnet someserver someport // this do output some text to screen
> echo "telnet test ending"[/color]
None of that is C++ so not covered by this newsgroup.
[color=blue]
>
> If I run the script from commandline, it do show the right way. with text
> from telnet function.
>
> But If I use the routine it only shows what was written in echo. And it do
> execute the script.
> If I make a script with wget
http://blabla/file_to_download
>
> this file are downloaded correctly into server.[/color]
The closest thing to what you're asking about that C++ has
is the 'std::system()' function (declared by header <cstdlib>
(or <stdlib.h>), which passes a string to the host command
processor (if one exists).
e.g.
std::system("some_command");
The function is standard, but its argument is not.
-Mike