How to get python console's stdin and stdout in msvc? 
Author Message
 How to get python console's stdin and stdout in msvc?

hi all:
 I gotta write a IDE for python, I have
try the following code but no effert,
why?
Also, i wanna the console window not be
shown, but failed.

// create process
 STARTUPINFO si;
 memset(&si, 0, sizeof(STARTUPINFO));
 si.cb = sizeof(STARTUPINFO);
 si.dwFlags = STARTF_USESTDHANDLES;
 si.hStdInput = hIn;
 si.hStdOutput = hOut;
 si.hStdError = hError;

 PROCESS_INFORMATION pi;

 bRetval = ::CreateProcess(
  "C:\\Program Files\\Python\\python
.exe",    /* here, if I use a DOS ap
plication, all is OK */
  NULL,
  NULL,
  NULL,
  FALSE,
  CREATE_NO_WINDOW,
  NULL,
  NULL,
  &si,
  &pi);
 ASSERT(bRetval);

who can help me?



Thu, 05 Sep 2002 03:00:00 GMT  
 How to get python console's stdin and stdout in msvc?

Quote:
> I gotta write a IDE for python.

That's no small project. You might want to look at IDLE:

http://www.python.org/idle/

Or PythonWin:

http://starship.python.net/crew/mhammond/

Quote:
> I have try the following code but no effert,
> why?
> Also, i wanna the console window not be
> shown, but failed.

The quick fix is to replace "python.exe" with "pythonw.exe".
There is a way of doing it in ::CreateProcess(), but I can't
remember offhand.

You'd be *much* better off using the python API in Python.h
and python15.lib/dll, rather than going through python.exe.
You'll have much more control over a script's execution. See:

http://www.python.org/doc/api/api.html

Start off with:

http://www.python.org/doc/api/veryhigh.html

Quote:
> [code snipped]

-----------------------------------------------------------------



Sat, 07 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Connecting win32 console apps in subprocesses to stdin/stdout

2. gets stdin problem from wish console

3. gets stdin: Mac Tk console

4. flush stdout, gets from stdin

5. Window's Console window (where is stdout)

6. getting output from command that isn't STDIN

7. Problem getting stdout redirected for embedded Python

8. getting stdout/stderr in embedded Python

9. JSPARC - STDIN/STDOUT?

10. Windows console stdin

11. (VA Smalltalk) - StdIn/StdOut - or - Named Pipes

12. STDIN and STDOUT with PB/DLL?

 

 
Powered by phpBB® Forum Software