I found the C snippet to get the current working directory from here. Essentially, the code is:
char directory[_MAX_PATH];
getcwd(directory, sizeof(directory))
I want to abstract that into another function, in a different file (so it can be swapped out on different platforms if necessary).
Currently, I have in the external file
void getCurrentDirectory(char *directory) {
getcwd(directory, sizeof(directory));
}
and in the main file
char directory[100];
getCurrentDirectory(directory);
printf("%s", *directory);
However, when printing to screen, I get nonsense (possibly trying to print memory location as a string?)
I'm sure it's something blindingly obvious to a non-beginner. What's going on?
Edit: I'm on Windows 7, btw
Thanks.