Project

Profile

Help

Support #2176 » test.c

O'Neil Delpratt, 2014-12-16 12:00

 
1
#include <stdio.h>
2
#include <unistd.h>
3
#include <errno.h>
4
#include <string.h>
5

    
6
int main(int argc, char** argv) {
7
  char buf[500];
8
  int r = readlink("/proc/self/exe", buf, 500);      
9
  if (r == -1) {
10
    printf("Error! error = %s\n", strerror(errno));
11
  } else {
12
    buf[r] = 0;
13
    printf("Ok! buf = %s\n", buf);
14
  }
15

    
16
  return 0;
17
}
(2-2/2)