docs:programming:cocoa_and_objective-c:returning_multiple_values

returning multiple values

  • correct example:
    Bool isDir;
     
    // path is an NSString *
    // &isDir means the address of the isDir variable
     
    if([filemanager fileExistsAtPath:path isDirectory:&isDir] && !isDir){
      // do something - we have a valid file that is not a directory
    }
  • along with this, remember that just creating a pointer doesn't create anything in memory - incorrect example:
    Bool *isDir;
    if([filemanager fileExistsAtPath:path isDirectory:isDir] && !isDir){
      // !! THIS WILL NOT WORK !!
    }
  • docs/programming/cocoa_and_objective-c/returning_multiple_values.txt
  • Last modified: 2008/08/03 00:25
  • by 127.0.0.1