Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- import re
- import subprocess
- cpp_skeleton = """\
- #include <iostream>
- using namespace std;
- int main()
- {
- /*![prog]*/;
- }"""
- print("### Debug1: {}".format(sys.argv[1:]))
- cpp_program = cpp_skeleton.replace("""/*![prog]*/""", sys.argv[1])
- print("### Debug2: {}".format(cpp_program.replace("""\n""", " ")))
- cpp_file = open("temp_pycpp.cpp","w")
- cpp_file.write(cpp_program)
- cpp_file.close()
- subprocess.check_call("g++ -std=c++14 temp_pycpp.cpp -o temp_pycpp.out", shell=True)
- subprocess.check_call("./temp_pycpp.out", shell=True)
- print("")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement