日期:2014-05-17 浏览次数:21104 次
程序编译的参照代码:
FilePath=UploadPath & "U" & session("id") & "\" FileFile="P" & request("ID") & ".pas" FileFileGcc="P" & request("ID") & ".c" FileFileCpp="P" & request("ID") & ".cpp" FileFileExe="P" & request("ID") & "_U" & session("id") &".exe" TpcPath=CompilerPath&"TPC\BIN\" FpcPath=CompilerPath&"FPC\bin\go32v2\" GccPath=CompilerPath&"GCC\bin\" FpcWord=FpcPath & "fpc -FE" & FilePath & " " & FilePath & FileFile & " > " & FilePath & "State.txt" TpcWord=TpcPath & "tpc " & FilePath & FileFile & " > " & FilePath & "State.txt" GccWord=GccPath & "gcc -g " & FilePath & FileFileGcc & " -o " & FilePath & FileFileExe CppWord=GccPath & "c++ -g " & FilePath & FileFileCpp & " -o " & FilePath & FileFileExe set WshShell = server.createobject("wscript.shell") succ = WshShell.Run(TpcWord,0,true)?
?
运行编译后的EXE文件的参照代码:
FilePath=UploadPath & "U" & session("id") & "\" FileFile="P" & request("ID") & ".exe" FileFile2="P" & request("ID") & "_U" & session("id") &".exe" InputFile = ProblemPath & "P" & request("ID") & "\Input\" & node(0) OutputFile = ProblemPath & "P" & request("ID") & "\Output\" & node(1) LogFile = UploadPath & "U" & session("id") & "\Log" & request("loc") & ".txt" set WshShell = server.createobject("wscript.shell") Word=FilePath & FileFile & " <" & InputFile & "> " & LogFile if (session("Compiler")="GCC")or(session("Compiler")="CPP") then Word="cmd /C""" & FilePath & FileFile2 & " <" & InputFile & "> " & LogFile & """" end if set oExec = WshShell.Exec(Word) while (timer()-startime<=timeli)and(oExec.status=0) wend if oExec.status=0 then oExec.Terminate if (session("Compiler")="GCC")or(session("Compiler")="CPP") then WordC="cmd /C""taskkill /F /IM "& FileFile & """" oExecC = WshShell.Run(WordC) end if Word=CompilerPath & "FileTheSame " & UploadPath & "U" & session("id") & "\Log" & request("loc") & ".txt " & ProblemPath & "P" & request("ID") & "\Output\" & node(1) succ = WshShell.Run(Word,0,true) if succ=2 then session("TextState")=session("TextState")&"输出文件过长.." response.Write("<span class=style6>输出文件过长...</span>") end if if succ=3 then session("TextState")=session("TextState")&"格式错误..." response.Write("<span class=style7>格式错误...</span>") end if if succ=4 then session("TextState")=session("TextState")&"答案错误..." response.Write("<span class=style3>答案错误...</span>") end if end if?