On Thu, May 21, 2009 at 2:26 AM, Bruce Johnson <bdjohnso...@gmail.com>wrote:
> > Post your croaking code. You seem to have some misapprehensions about > how > > command-line arguments work, > > No misapprehensions here. Sorry, but I'm afraid there are. > > What CLI were you planning to run on iPhone? > The CLI is for a Cocoa App There's no CLI at all in the code you posted. > char mdfile[PATHSIZE]; > strncpy(mdfile, <pathToFile>, MAXREAD); > > FILE * stream = fopen(<pathToFile>, "rt"); > ... > > So as you can see, a non-escaped, white space laden "pathToFile" will > return a bogus FILE *stream. No it won't. Spaces are only relevant to commands typed into a shell, or used in a shell script. They're used by the shell to split its input into the path to a command, and arguments to pass to it. Spaces, and other characters that are meaningful when used in a shell, such as <, >, &, $, or |, are of no importance whatsoever when passed to fopen. No escaping or quoting is necessary. To see what's really going on, try this immediately after your fopen: if (NULL == stream) NSLog(@"Could not open '%s': %s", pathToFile, strerror(errno)); sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com