|
From: Johannes P. <joh...@pr...> - 2001-06-19 15:57:02
|
Hi there
------------
Sorry for sending to your personal mail. but I have trouble sending to the
DevCpp list. it something (well most of the times) reject my mail.
Also I want to ask if this IDE that you are planning to code. Will be
compiler specific. For (exept for WinEdit) I am looking for a
IDE that can use almost any compiler. Like Borland C++ 5.
Well just wanted to ask considering I cant get onto the DevCpp list to ask
this Question..
Thanks for your time and sorry for mailing your private..
Johannes Pretorius
At 07:25 19/06/2001 -0400, you wrote:
>Hi,
>Thank you for this code, it appears to work correctly with GCC.
>
>Sincerely,
>Brian
>
>"Shall we accept good from God, and not trouble?" Job 2:10
>-----Original Message-----
>From: dev...@li...
>[mailto:dev...@li...]On Behalf Of Elias
>Pschernig
>Sent: Monday, June 18, 2001 5:17 PM
>To: dev...@li...
>Subject: Re: [Dev-C++] Reading GCC output
>
>
> > I apologize for not being clear. I am coding a small IDE that invokes
>the GCC compiler, just
> > like Dev-C++ does. Dev-C++ catches the output produced by GCC and displays
>the errors,
> > warnings, and other GCC output at the bottom of the program. I would like
>to know how to do
> > just that: invoke GCC from my program, catch the output, and display it. I
>know how to invoke
> > GCC and display any output, but I do not know how to catch the output.
>Could someone point me
> > in the right direction? Thanks in advance.
>
>Hi, i don't know why the source code you posted doesn't work. I'm using
>basically the same code in my programs. The program below works fine for me
>under win98, i'm using the code to catch output for another program, but it
>seems to work with 'gcc' just the same.
>
>I didn't look at your code in detail, but it's almost the same procedure:
>
>Cerate a temporary file, redirect the output from the called command into
>that file, then read the contents of the temporary file and delete the file.
>
>I compiled with 'gcc -mwindows -O3 -s -o catch.exe catch.c', but should of
>course work with a dev-c++ project as well.
>
>(Warning: This code may contain all sort of mistakes and bugs)(but i hope it
>does work)
>
>Elias Pschernig
>
>-- catch.c
>#include <windows.h>
>
>void execute(char *command) {
> char tempdir[1024];
> char tempfile[1024];
> STARTUPINFO sui;
> PROCESS_INFORMATION pi;
> HANDLE capture;
>
> GetTempPath(1024, tempdir);
> GetTempFileName(tempdir, "bla", 0, tempfile);
>
> capture=CreateFile(tempfile,GENERIC_READ|GENERIC_WRITE,0,NULL,
> CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
>
> memset(&sui,0,sizeof sui);
>
> sui.cb = sizeof sui;
> sui.lpTitle = "my redir";
> sui.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
> sui.hStdOutput = capture;
> sui.hStdError = capture;
> sui.hStdInput = NULL;
> sui.wShowWindow = SW_HIDE;
>
> if(CreateProcess(NULL, command,
> NULL, NULL, TRUE, 0, NULL, tempdir, &sui, &pi)) {
>
> char *buffer;
> DWORD size;
>
> WaitForSingleObject(pi.hProcess, INFINITE);
>
> SetFilePointer(capture, 0, NULL, FILE_BEGIN);
> size = GetFileSize(capture, NULL);
> buffer = alloca(size+1);
>
> ReadFile(capture, buffer, size, &size, NULL);
> buffer[size] = 0;
>
> CloseHandle(capture);
>
> CloseHandle(pi.hThread);
> CloseHandle(pi.hProcess);
>
> DeleteFile(tempfile);
>
> MessageBox(NULL,buffer,"Captured Output",MB_OK);
>
> } else {
> MessageBox(NULL,command,"Error: Could not execute",MB_OK);
> }
>
>}
>
>int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) {
> execute("gcc -v");
> return 0;
>}
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>---
>Incoming mail is certified Virus Free by AVG
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
>
>---
>Outgoing mail is certified Virus Free by AVG
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
>
>
>NetZero Platinum
>No Banner Ads and Unlimited Access
>Sign Up Today - Only $9.95 per month!
>http://www.netzero.net
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|