- Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathGenerateSH.cpp
More file actions
Latest commit
30 lines (27 loc) · 705 Bytes
/
Copy pathGenerateSH.cpp
File metadata and controls
30 lines (27 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//To generate link.sh and codevillage.sh files
#include<iostream>
#include<fstream>
#include<cstring>
#include<unistd.h>
usingnamespacestd;
intmain ()
{
ofstream file1;
ofstream file2;
string currentDir;
char cwd[2048];
if(getcwd(cwd, sizeof(cwd))!=NULL)
{
currentDir=cwd;
//cout<<currentDir;
file1.open ("CodeRunner.sh");
file1 << "until "+currentDir+"/link.sh; do \n echo \" CodeRunner crashed with exit code $?. Respawning.. \" >&2 \n sleep 1 \n done";
file1.close();
file2.open ("link.sh");
file2 << currentDir+"/main -q";
file2.close();
}
else
perror("getcwd() Status");
return0;
}