• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I bought the book: O'Reilly Learning Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I bought the book: O'Reilly Learning Cocoa


  • Subject: Re: I bought the book: O'Reilly Learning Cocoa
  • From: Scott Anguish <email@hidden>
  • Date: Fri, 8 Feb 2002 05:28:45 -0500

I'm not sure that obsolete is the right word..

This code is fine if you want to load the contents of the file into a buffer. Obj-C is just plain C with some extensions... so this will work..

although it would be much easier to just do this

theData=[NSData dataWithContentsOfFile:@"/path/to/the/file"];

Now, responding to Cmd-O, that's a bit different.. you'd need to create a menu item, or use the NSDocument classes to a more full featured app...

have a look at

http://www.stepwise.com/VermontRecipes

for a bit of a hint on the document stuff

or

http://www.stepwise.com/HTMLEditor (but that hasn't been cleaned up for Mac OS X, the APIs are I think the same, but the tools are slightly different)


On Friday, February 8, 2002, at 04:06 AM, Gjermund G Thorsen wrote:

And it covers a basic foundation in GUI... But how to find out about the standard filerequester and how to make my app look the same when pressing apple+o like all other cocoa-apps?

Is this piece of code obsolete? What would the obj-c equivilent be?

if ((infd = open(infile, O_RDONLY)) == -1) {
perror("infd == -1");
exit(-1);
}

insize = fstat((int) infd, &sb) < 0 ? 0 : sb.st_size;
worksize = insize + extrasize;

workbuf = (char *)malloc(worksize);

if(read(infd, workbuf, insize) != insize) {
perror("read(infile) != size");
close(infd);
free(workbuf);
exit(-1);
}

--
Yours Sincerely,

Gjermund Gusland Thorsen



"Youre just a picture, youre an image caught in time." - Ronnie James Dio
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: NSMovie view animation?
  • Next by Date: Re: NSMovie view animation?
  • Previous by thread: Re: NSMovie view animation?
  • Next by thread: [ANN] Cocoa Browser ver 0.2
  • Index(es):
    • Date
    • Thread