33 lines
486 B
C
Raw Normal View History

2014-08-03 19:52:23 +02:00
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
2018-08-09 18:06:22 +02:00
# include <direct.h>
# define getcurdir _getcwd
2014-08-03 19:52:23 +02:00
#else
2018-08-09 18:06:22 +02:00
# include <unistd.h>
# define getcurdir getcwd
2014-08-03 19:52:23 +02:00
#endif
int main(int argc, char* argv[])
{
#define BUFSZ 20000
char buf[BUFSZ + 1];
#ifdef _WIN32
2016-07-09 11:21:54 +02:00
char* pos;
2014-08-03 19:52:23 +02:00
#endif
getcurdir(buf, BUFSZ);
#ifdef _WIN32
pos = buf;
2016-07-09 11:21:54 +02:00
while (*pos) {
if (*pos == '\\') {
2014-08-03 19:52:23 +02:00
*pos = '/';
}
2016-07-09 11:21:54 +02:00
++pos;
}
2014-08-03 19:52:23 +02:00
#endif
printf("%s\n", buf);
return EXIT_SUCCESS;
}