Mr. Book
November 7th, 2007, 04:15 AM
Simple question, I know I must be doing something wrong. I want to make a directory inside my C++ program. I've looked online and found tutorials that say there is a mkdir() function included in <sys/dir.h> (all this does is include dirent.h). This is true and I have gotten it to work under mingw with the code:
if(0<mkdir("doc")) { printf("ERROR\n") return 1; }
But my code does not compile on my ubuntu system. I get the following error:
xcg.cpp:305: error: ‘mkdir’ was not declared in this scope
I did a search inside dirent.h and could not find the string mkdir. searching on google & this forums haven't show what i have been looking for because the "make" and "mkdir" commands overshadow the function that I am looking for. I know this is a simple task and I feel stupid for not being able to find it. any help would be greatly appreciated.
if(0<mkdir("doc")) { printf("ERROR\n") return 1; }
But my code does not compile on my ubuntu system. I get the following error:
xcg.cpp:305: error: ‘mkdir’ was not declared in this scope
I did a search inside dirent.h and could not find the string mkdir. searching on google & this forums haven't show what i have been looking for because the "make" and "mkdir" commands overshadow the function that I am looking for. I know this is a simple task and I feel stupid for not being able to find it. any help would be greatly appreciated.