Professional Web Applications Themes

Text files - Mac Programming

Would the regular C/C++ file i/o work for text file i/o, or would it be advantageous to use the various Cocoa methods and classes? If so, where can I find a good tutorial? -- I am only a mirage....

  1. #1

    Default Text files

    Would the regular C/C++ file i/o work for text file i/o, or would it be
    advantageous to use the various Cocoa methods and classes? If so,
    where can I find a good tutorial?

    --
    I am only a mirage.
    kelvSYC Guest

  2. #2

    Default Re: Text files

    On Mon, 17 May 2004, kelvSYC wrote:
     

    If you know C or C++ file IO and are comfortable with it, there's no
    reason not to use it. You can get a C string to pass to fopen and friends
    from an NSString that contains a pathname using [string
    fileSystemRepresentation]. Otherwise, the Cocoa classes are easy enough to
    learn and use, although they're more wordy. Depending on your needs, you
    can read the entire file at once using something like [NSData
    dataWithContetnsOfFile:...], or you can use NSFileHandle to read it piece
    by piece. The doentation is clear and the concepts aren't very
    difficult.
    Michael Guest

  3. #3

    Default Re: Text files

    On 17/05/2004, kelvSYC wrote in message
    <170520041611066125%email.shaw.ca>:
     

    The C routines will work, of course, but if you're already using Cocoa
    then your code will end up far simpler if you stay consistent.
    Fortunately, if you want to operate on the file as a whole (as opposed
    to processing a small piece of a small file) you can read it in in
    just one method, either into an NSString or an NSData , and write it
    out in another instruction. Getting the entire task done in just two
    lines is the sort of thing that makes programming in Objective-C.

    Simon.
    --
    Using pre-release version of newsreader.
    Please tell me if it does weird things.
    Simon Guest

  4. #4

    Default Re: Text files

    In article <c8gpd3$4n4$3$demon.co.uk>, Simon Slavin
    <demon.co.uk> wrote:
     

    I think mean "using Cocoa" vs. "programming in Objective-C." bc many
    c++ frameworks do the same quite nicely.
    Chris Guest

Similar Threads

  1. Input Text (External Text Files)
    By khabuki in forum Macromedia Flash Sitedesign
    Replies: 3
    Last Post: May 12th, 03:30 PM
  2. Pasting Text files into a text field?
    By Ernie Faulkner in forum FileMaker
    Replies: 3
    Last Post: October 17th, 03:27 PM
  3. Dynamic Text Loaded from Text files -> Flash 5 <-
    By war_mice webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: July 30th, 08:45 PM
  4. Link Text files to SWF files.
    By dark_sage webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 1
    Last Post: July 28th, 12:33 PM
  5. How to create help files / text files
    By Falcon in forum FileMaker
    Replies: 4
    Last Post: July 15th, 11:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139