TOC | PREV | NEXT

Problem: PathNames are totally hosed and a have garbage in them
      
      old code:

            char buf[MAXPATHLEN];
            sprintf(buf,"%s/%s",path,file);
      
      converted incorrectly:

            NSString *buf;
            buf = [NSString stringWithFormat:@"%s/%s",path,file];
            
            (gdb) po buf
                  \030\020l\004] (ie garbage!)


Solution: If path and file are also converted to NSStrings, then they are being treated as char *'s with the %s format, use the %@ NSString format:

      buf = [NSString stringWithFormat:@"%@/%@", path, file];

            or even better for cross platform development:

      buf = [path stringByAppendingPathComponent:file];



TOC | PREV | NEXT
Match: Format:
Search:
Created by Stone Design's Create on 6/2/1997