I am trying to create a global const char array to store the users home directory, well, plus some other text, here is an example of what I'm trying to do:
Now from doing a web search on my problem I've realized that you can not run functions from outside a function, so how else would I go about doing this? Is what I'm trying to do even possible? I'm fairly new to C, would it just be more practical to just change the working dir to it in the beginning of the main function, and not even make it a variable at all?Code:const char configdir[] = strcat(getenv("HOME"), "/.myappconfig"); int main() { // CODE GOES HERE }
Thanks in advance for helping a noob![]()



1Likes
LinkBack URL
About LinkBacks




