Re: Q:show output from script
From: Mike Wahler (mkwahler_at_mkwahler.net)
Date: 01/09/05
- Next message: Siemel Naran: "Re: How to write such a function?"
- Previous message: Siemel Naran: "Re: size_t and int comparison"
- In reply to: R. Stormo: "Q:show output from script"
- Next in thread: R. Stormo: "Re: Q:show output from script"
- Reply: R. Stormo: "Re: Q:show output from script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 09 Jan 2005 21:18:24 GMT
"R. Stormo" <anti_rohnny@spam_stormweb.no> wrote in message
news:FjaEd.81749$Vf.3693222@news000.worldonline.dk...
> I have a problem showing output that is comming from a script.
> If I make a script running at commandline it do work and everything
> are showing.
> But when I try to execute it from within my proggy it would not show.
> I have tried to save the outout to a file and again, when I runit from
> commandline it do save everything but from software it would not.
> It do only show things that are outputed with "echo"
>
> My routine for showing the file are, the execute script rutine are the
same.
>
> FILE *fp; //The filePIPE
> char message[1024]; //Declare buffer to hold the file
This is an array of uninitalized characters.
> fp = fopen( myfilename, "r" );//Read read in txt mode
> if ( fp==NULL )
> msgbox("could not open file to read !!!", "Warning");//Show File not
> found!
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.:
puts("could not open file to read !!!");
> else
> {
> while( !feof( fp ) ) //check for EOF
You're using 'feof()' incorrectly. See the C FAQ for details.
> {
> fgets( line, 128, fp ); //Read 128 bytes
You should check the return value of 'fgets()' to see if
an error occurred.
> strcat( message, line ); //Add this line to previous buffer
'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.
> }
> fclose(fp); //Close the filePIPE
> //------------------------------
> // Show the output in a dialogbox on screen
> //------------------------------
> eMessageBox msg(message, "OUTPUT", eMessageBox::iconInfo
> eMessageBox::btOK);
> msg.show(); msg.exec(); msg.hide();
>
> }
-Mike
- Next message: Siemel Naran: "Re: How to write such a function?"
- Previous message: Siemel Naran: "Re: size_t and int comparison"
- In reply to: R. Stormo: "Q:show output from script"
- Next in thread: R. Stormo: "Re: Q:show output from script"
- Reply: R. Stormo: "Re: Q:show output from script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|