scandir(3) problems with names w/spaces
I am writing a command line utility under MacOS 10.4.11 using XCode and I have run into a problem that has me buffalo'd. I have managed to create a utility that reads command line arguments and processes option letters and directory names, much as ls(1) would. However, when I pass in a directory name containing spaces, the scandir utility returns a -1 (fail). Now, I was careful to make sure that the directory name was enclosed in quotes on the command line and when I look in the debugger when I call scandir, the directory name variable contains the entire directory name (e.g. ~/dir1/dir2/dir 3). But for some reason scandir can't handle the name, even though it has handled everything else I've thrown at it, relative directory names, full names, names using the "~" like the example. Any ideas anyone?
Thanks a million!
MacBook w/2Ghz Core-Duo & 2GB Ram, Mac OS X (10.4.11)