fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int fd;
  5. int len;
  6. void *ptr;
  7. main() {
  8. int argc = *%rsp;
  9. char* arg1 = *(%rsp + 16);
  10. if(argc != 1) goto exit;
  11.  
  12. fd = open(arg1, O_RDONLY, 0);
  13. len = lseek(fd, SEEK_END, 0);
  14. ptr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
  15. write(stdout, ptr, len);
  16. munmap(ptr, len);
  17. close(fd);
  18. exit:
  19. exit(0);
  20. }
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:8:17: error: expected primary-expression before ‘%’ token
     int argc = *%rsp;
                 ^
prog.cpp:8:18: error: ‘rsp’ was not declared in this scope
     int argc = *%rsp;
                  ^~~
prog.cpp:9:20: error: expected primary-expression before ‘%’ token
     char* arg1 = *(%rsp + 16);
                    ^
prog.cpp:12:21: error: ‘O_RDONLY’ was not declared in this scope
     fd = open(arg1, O_RDONLY, 0);
                     ^~~~~~~~
prog.cpp:12:32: error: ‘open’ was not declared in this scope
     fd = open(arg1, O_RDONLY, 0);
                                ^
prog.cpp:13:32: error: ‘lseek’ was not declared in this scope
     len = lseek(fd, SEEK_END, 0);
                                ^
prog.cpp:14:27: error: ‘PROT_READ’ was not declared in this scope
     ptr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
                           ^~~~~~~~~
prog.cpp:14:38: error: ‘MAP_SHARED’ was not declared in this scope
     ptr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
                                      ^~~~~~~~~~
prog.cpp:14:55: error: ‘mmap’ was not declared in this scope
     ptr = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
                                                       ^
prog.cpp:15:27: error: ‘write’ was not declared in this scope
     write(stdout, ptr, len);
                           ^
prog.cpp:16:20: error: ‘munmap’ was not declared in this scope
     munmap(ptr, len);
                    ^
prog.cpp:17:13: error: ‘close’ was not declared in this scope
     close(fd);
             ^
stdout
Standard output is empty