• 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: How to read a text file over a network
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to read a text file over a network


  • Subject: Re: How to read a text file over a network
  • From: Dave Zwerdling <email@hidden>
  • Date: Tue, 14 Dec 2010 13:52:59 -0800

You should check out NSFileManager to see if you can simplify your read methods - specifically the contentsAtPath: method.
Then decode the data from the file using the appropriate encoding.
Once you've figured out what the URI for the file is, you can use NSFileManager again to fetch it, using an NSUrl.

It sounds like you might have an easier time using a plist.  Cocoa has good support for parsing and simplifying access using NSDictionary.



On Dec 13, 2010, at 4:54 AM, Abhijeet Singh wrote:

> Hi,I am new to Mac. In my application I have to read a text file (say file1.txt) from a user defined location/path. User defines this filepath in another text file (say file2.txt). My program first reads file2.txt and gets the path of file1.txt from there. file2.txt always exists on my machine but file1.txt can be anywhere on network. My question is if user wants to define some network file path then:How to define a network file path? (I tried keeping file1.txt over a network and define its path as given in "Get Info" panel in file2.txt)How to read a file over a network? (I am reading file using C functions fopen, fscanf, fgets. Do i need to use any function from cocoa?)Thanks & RegardsAbhijeetDear cocoadev ! Get Yourself a cool, short @in.com Email ID now!
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to read a text file over a network (From: "Abhijeet Singh" <email@hidden>)

  • Prev by Date: Re: - resolveInstanceMethod:
  • Next by Date: Re: - resolveInstanceMethod:
  • Previous by thread: Re: How to read a text file over a network
  • Next by thread: Re: Re: How to read a text file over a network
  • Index(es):
    • Date
    • Thread