Click to See Complete Forum and Search --> : CreateDirectory("C:\\Temp 2", NULL); // FAILS!!


markiemooster
March 17th, 2004, 01:22 PM
CreateDirectory("C:\\Temp 2", NULL); // FAILS!!

I'm using XP Pro and have tried to create a directory using the code above but it fails. I've tried appending an extra '\' but the function still fails. :confused:

Can anyone please help me?

Thanks,
Mark

Andreas Masur
March 17th, 2004, 01:42 PM
Well..first of all you can call 'GetLastError()' to retrieve a specific error code.

It might have problems with the space within the name...

Sam Hobbs
March 17th, 2004, 02:16 PM
It works for me.

Please, when saying things like "doesn't work", "gets an error", "gets an assertion" or "fails", please specify how it doesn't work, or what the error is, or what the assertion says or what the failure is.

Also, before posting here, please, please, please add code to check for errors. For example, in this case, use GetLastError to get the error code.

markiemooster
March 18th, 2004, 06:09 AM
I apologise for wasting everyone's time. It works for me too now.

I was so tired when I made my post that I'd overlooked part of my recursive funtion.

The reason for the apparent failure was due the the result of CreateDirectory being ANDed with the result of the previous call to the recursive function. The result of the previous call was FALSE but I was just too stupid to notice. Maybe the recursion wasn't such a good idea after all!

Sorry guys. I'm gorging myself with humble pie if it's any consolation. :blush:

Andreas Masur
March 18th, 2004, 07:46 AM
Well...I guess these kind of things happens for all of us once in a while...no need to apologize... :cool: