• 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
Reading/Writing Text files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reading/Writing Text files


  • Subject: Reading/Writing Text files
  • From: email@hidden
  • Date: Mon, 11 Sep 2006 08:29:40 EDT

Slightly frustrated here. What I need to do is this...

I need to read in text files off a PC, manipulate some bytes of data and then
write the data back out to plain text files. How do I do this? It seems every
Cocoa application example I look at assumes that you want to use an encoder,
so all I can find are examples of reading and writing with encoders.

I just want to.

1: Read in the text file into an NSTextView
2: Have the user make some minor changes
3: Write the new data back out (To a Plain text file)

Is this possible??

Here is what I have so far... just so you have an idea of what I'm trying to
do

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type
{

     // Let's see what we're getting...
     NSLog(@"loadDataRepresentation: %@: %@",type, data);

     NSAttributedString *tempString = [data description];

     [self setString:tempString];

     if ([self string] != nil)
     {

          [[myTextView textStorage] setAttributedString: [self string]];

     }

    return YES;
}
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Reading/Writing Text files
      • From: Douglas Davidson <email@hidden>
    • Re: Reading/Writing Text files
      • From: John Stiles <email@hidden>
    • Re: Reading/Writing Text files
      • From: Nir Soffer <email@hidden>
    • Re: Reading/Writing Text files
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Query regarding passing the values to the server
  • Next by Date: Re: newbie question regarding setting up a master-detail data model with cocoa
  • Previous by thread: Query regarding passing the values to the server
  • Next by thread: Re: Reading/Writing Text files
  • Index(es):
    • Date
    • Thread