Online OJ project

Requirements: to achieve a online judge, users prepare and submit the code through the browser, transferred over the network, the code is uploaded to the background, the background of the code submitted compile and run, will compile and run the results back to the user
process station before and after the online OJ :
Online OJ project

Project is divided into five modules:

Network Service Module
to build server http:
I used is available on GitHub open source httplib.h library when building http services, we only need to include this header file can be used
to provide http services, modules, and compile and run the series questions module
1. Get topic list
2. Submit the selected topic
3. Submit the subject code and subject description, compiled code block
questions module
1. Title loaded from a configuration file
a configuration file format:
conventions profile of the subject among the description of
the subject the number, the name of the subject, the directory where the title, item difficulty
b. load the subject of profiles using a data structure stored loaded out of the topic provides information
c. for every subject, the need to load the path given
2. provide access to the whole subject of the interface
to the network service module provides an interface to all the questions can be obtained as described, displayed to the user
3. to provide a single interface to the topic
obtain a single title description and answer interface to the network service module, presented to the user
to compile and run module
1. compile
a. the code is written to a file submitted by the user
b. create a child into , And performs the program replaced g ++ programs, compiling source files
c. Gets compiled results to standard output or write a file among the standard error file
2. Run
a. If the code come operating phase, certain instructions executable program compiled , and create a child process, and let the child be programmed replacement, replace the executable program
in b. the result of the program, save it to standard output or standard error file
Log module
1. To provide time stamp: To distinguish between the different codes submitted by the user, among contemporary written to the file when it using a timestamp to distinguish
2. To provide URL decoding operation
tool module
1. To achieve the cutting function string
2. provide write file operation
3. provide read file operations

Guess you like

Origin blog.51cto.com/14233078/2482945