• 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: read data from an .txt file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read data from an .txt file


  • Subject: Re: read data from an .txt file
  • From: "Sean McBride" <email@hidden>
  • Date: Mon, 27 Nov 2006 11:03:06 -0500
  • Organization: Rogue Research

On 2006-11-27 15:52, Jürgen Keser said:

>I create an .txt file that contains some data. Now I want to store all
>the data
>from the .txt file in an char or an Str255. Here is a snippet of the
>code I use.
>Is this the right way to get the data of the .txt file? How must I go on?
>
>Or is it better to do that with fopen/fread...
>
>
>FSSpec spec;
>SInt8 tt = true;
>short fileRefNum;
>
>err = FSMakeFSSpec(spec.vRefNum,spec.parID,spec.name,&spec);
>
>err = FSpOpenDF(&spec,tt,&fileRefNum);
>long count = 1;
>char ch[255];
>if(!err){
>	err = FSRead(fileRefNum, &count, &ch);
>	if(!err){
>		FSClose(fileRefNum);
>      }
>}

Do not use any functions that use FSSpec.  To catch yourself doing this,
turn on the "Warn about deprecated functions" warning in Xcode.  You can
use fopen/fread, newer Carbon functions, Cocoa functions-- it all
depends on your app and your preferences.  Just stay far away from FSSpec. :)

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >read data from an .txt file (From: Jürgen Keser <email@hidden>)

  • Prev by Date: Re: Optimization questions
  • Next by Date: Re: Optimization questions
  • Previous by thread: read data from an .txt file
  • Next by thread: Re: read data from an .txt file
  • Index(es):
    • Date
    • Thread