1. Indirect (indirection)
1.1 Variables and indirection (use variables to replace some numbers)
1.2 Indirect use of file names
const indicates that a variable is not allowed to be changed
const int Nvalue;//nvalue is const
const char *pcontent; *pcontent is const, pcontent variable
const char* Const pcontent; Pcontent and *pcontent are both const.
Strlen (String value); Returns the length of the value string
As the following example, can be written by non-professional files, which is indirect, but the path is the decision path, not too ideal
FILE *worldfile = fopen ("/tmp/words.txt", "R"); Open the file and read the contents of the file, where TMP is the UNIX temp directory
Char word[100];
while (fgets (Word, wordfile)) {//fgets () reads a line of text from a file and places it in Word
Word[strlen[word]-1] = ' + '; The fgets () call retains a newline character that separates each line, and we don't need to, if we leave him, add a char, so instead
NSLog (@ "%s is%d characters long", Word,strlen (word)); Printing information
}
Fclose (Wordfile); Close File
OBJECT-C 1.0 Chapter III: Object-Oriented Programming fundamentals (OOP)