Training For Xcode - Read and Write Files description for Xcode 7 does not work

John Cipolla's Avatar

John Cipolla

23 Jan, 2016 01:41 PM

I purchased Training For Xcode from the Apple App store. It appears the code you provide for Read and Write Files does not work with Xcode 7. There are no errors displayed when run but the code is simply ignored during runtime. For one thing there is no Build/Debug directory in Xcode 7. My code follows. The global variables code discussion works fine. Also, I created my text file in every possible location and every attempt returned the null file condition. Can you tell me what has changed in Xcode 7 to make it possible for your description to work properly for reading and writing files? Because your Xcode training course does not appear as a category I chose a similar topic.

    int main(int argc, char *argv[]){
    
// NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
// Define global variables
    gCd = 1.289;
    
// Print a global variables (test)
// NSLog(@"%F", gCd);
    
    NSString *string = @"I like bacon and ham";
    NSLog(@"%@", string);
    
// Read data from file
    NSFileHandle *fin, *fout;
    NSData *buffer; // buffer holds data during read
    
// Open data file for reading and writing
    fin = [NSFileHandle fileHandleForReadingAtPath:@"Data_File"];
    
    [[NSFileManager defaultManager]createFileAtPath:@"Data_File_New" contents:nil attributes:nil];
    fout = [NSFileHandle fileHandleForWritingAtPath:@"Data_File_New"];
    
// truncate file, delete old file contents
    [fout truncateFileAtOffset:0];

// Open data file and transfer it to buffer
    buffer = [fin readDataToEndOfFile];
    
// Copy data from buffer to variables
    [fout writeData: buffer];
    NSLog(@"%@", fout);

// Close input and output files
    [fin closeFile];
    [fout closeFile];
    
// [pool drain];
    return NSApplicationMain(argc, (const char **) argv);

}

Thank you.
John Cipolla

  1. 1 Posted by John Cipolla on 20 Feb, 2016 12:27 PM

    John Cipolla's Avatar

    Why did HALFBIT remove Training For Xcode and stop support a few days after I purchased your product?

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac