I used to be engaged in VC ++ development. Now I have switched to iPhone development because of the needs of the project.
First install a virtual machine, and then install xcode.
I wrote a hello World program. It is okay to generate it.
Next, use the same project to write a program to read text files. The code is very simple, similar to that below VC, as shown below:
NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc] init];
// Insert code here...
File * txtfile = fopen ("1.txt"," R ");
Char word [100];
If (nil = txtfile)
{
Nslog (@ "file is not exist! ");
Return 0;
}
While (fgets (word, 100, txtfile ))
{
Word [strlen (Word)-1] = '\ 0 ';
Nslog (@ "% s is % d character long", word, strlen (Word ));
}
Fclose (txtfile );
[Pool drain];
Return 0;
After running the final result for half a day, I did not find 1.txt. But is 1.txt clearly under the project folder? There is no problem with the code below in VC ++. Why is there a problem here?
Then I thought, do I need to put it in the build directory? However, no build is found under the stored directory. Therefore, the default directory generated by xcode is as follows:
/Users/user name/library/developer/xcode/deriveddata/product name-fylcrwghjxojxcgaejhixgwinhus/build/products/debug
The Chinese Mac OS directory is
User/your user name/resource library/developer/xcode/product name-fylcrwghjxojxcgaejhixgwinhus/build/products/debug
Then put the file in the DEBUG directory and run the program again. The result is displayed as normal.
You can change the directory generated through system preference settings.