how to simulate keyboard actions to a sub-thread

This is a discussion on how to simulate keyboard actions to a sub-thread within the Windows Programming forums, part of the Platform Specific Boards category; Hi guys, we decided to create a on-line judging system, the user submits a piece of code and our system ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    1

    Question how to simulate keyboard actions to a sub-thread

    Hi guys, we decided to create a on-line judging system, the user submits a piece of code and our system compiles it and run it with some test data and the results will be returned to let the user know. we think of using two thread to do this. the main thread supervises the sub-thread and the sub-thread is the user code. but the question is how to convey the test date through the main thread to the sub-thread? the user's code will be compiled into some DOS application, and it receives the test code through functions like "scanf" or "cin".

    a sample of the system can be found at http://acm.pku.edu.cn/JudgeOnline/

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Redirect the program's standard input that way calls to scanf and cin won't take input from the console they can take input from a file or pipe.
    You can do this in the STARTUPINFO structure that you pass to CreateProcess.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Terminating secondary thread from another thread
    By wssoh85 in forum C++ Programming
    Replies: 13
    Last Post: 12-19-2008, 05:14 AM
  2. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 02:17 PM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 09:56 AM
  4. pointer to main thread from worker thread?
    By draegon in forum C++ Programming
    Replies: 2
    Last Post: 10-27-2005, 07:35 AM
  5. Critical Sections, destroying
    By Hunter2 in forum Windows Programming
    Replies: 4
    Last Post: 09-02-2003, 11:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21