开发者

What folder do I place a file to pass in as a command line argument in xcode 4?

What folder do I place 开发者_C百科a file to pass in as a command line argument in xcode 4? I'm placing my list.txt file in the folder that xcode created but when I test for the existence of the file I'm getting NULL.I thought that when I edit the scheme and add list.txt as an argument that the file would be passed in.


Either you should pass the full path to the file, or you need to figure out the working directory that Xcode launches the executable in:

NSString *workingDir = [[[NSProcessInfo processInfo] environment] objectForKey:@"PWD"];
NSLog(@"working directory = %@", workingDir);

and put your file in that dir.


You don't have to put your file in a certain directory, you just need to make sure Xcode knows where you are keeping your files.

Product>>Edit Scheme(Command + <)
"Run ..." (from the column menu)
"Options" (tab)

Click the "Working Directory" check box, and browse to the directory you keep your files in.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜