Questions tagged [nsfilehandle]

The NSFileHandle class is an object-oriented wrapper for a file descriptor. You use file handle objects to access data associated with files, sockets, pipes, and devices. For files, you can read, write, and seek within the file. For sockets, pipes, and devices, you can use a file handle object to monitor the device and process data asynchronously.

139 questions
2
votes
1 answer

Flush a pipe associated to an NSFileHandle

I am reading piped output from a console application via an NSFileHandle in Cocoa. How can I flush the stream associated to that file handle. If I could get a FILE* object from the NSFileHandle I could call fflush(). Is there a way around this?
Duncan
  • 443
  • 1
  • 5
  • 12
2
votes
2 answers

How to read text chunks from a huge text file?

I am trying to read a text file containing characters in billions. Using the function contentOfFile is not working, as my application get crashed due to it. So anybody please send me the sample code so that I get the chunks according to my…
rptwsthi
  • 10,094
  • 10
  • 68
  • 109
2
votes
0 answers

how to add,insert,delete a piece of data in a file directly,like the NSMutableArray

I checked Iphone SDK Documentation, find NSFileHandle object, it said "with NSFileHandle, you can range over an open file and insert, extract, and delete data." but I could only find the way to replace the exist data by using "seekToFileOffset:" and…
dami
  • 21
  • 3
2
votes
1 answer

iOS ALAssetsLibrary and NSFileHandle reading file contents

I want to read the contents of an assets library file in iOS NSFileHandle fileHandleForReadingFromUrl using the asset defaultRepresentation url seems to always return 0x0... I'll keep looking for a solution in the mean time. EDIT: Looks like the…
cynistersix
  • 1,215
  • 1
  • 16
  • 30
2
votes
1 answer

What are Sockets, Pipes and Devices?

I'm studying the Low-Level File Management Programming Topics from Apple. In the NSFileHandle section, they say: The scope of NSFileHandle is not limited to files. It provides the only Foundation object that can read and write to…
Proud Member
  • 40,078
  • 47
  • 146
  • 231
2
votes
2 answers

Xcode app version not compatible with Mac OS X version

am using Os X 10.6.4 and X code Version 3.2.3 for developing some simple app files and using PackageMaker to distribute these app files. But when trying to run the package on some other mac I am getting error that the package is not compatible with…
Aniket
  • 131
  • 1
  • 3
  • 9
2
votes
1 answer

Do I need to close an open NSFileHandle while concurrently reading the file in a different source?

I'm logging data to a file that I keep open with NSFileHandle. These log files can be emailed out, is it necessary to close NSFileHandle before I send the email
pflous
  • 573
  • 6
  • 17
2
votes
1 answer

Can't get NSFileHandleDataAvailableNotification to fire for stdout pipe

We need to capture stdout in iOS because we are using an open source project that communicates via stdin/stdout This works: NSPipe *pipe = [NSPipe pipe]; NSFileHandle *readh = [pipe fileHandleForReading]; dup2([[pipe fileHandleForWriting]…
Lightbeard
  • 4,011
  • 10
  • 49
  • 59
2
votes
3 answers

Filepath from NSFileHandle on iOS (Swift or Objective-C)

I got NSFileHandle from a function call and would like to access the file it refers to. How to get it? I know that the resource might have multiple file paths or no file path at all (file in memory). However, it would be nice to get anything :)
Lukasz Czerwinski
  • 13,499
  • 10
  • 55
  • 65
2
votes
1 answer

Is it possible to search files of particular extension in the entire device?

In my application, i am trying to find all files of particular extension (like .pdf, .txt, etc) that are stored in the device (either downloaded or transferred from system) and want to list them in table View. Is it possible to do so and if it is…
user302326
2
votes
3 answers

uncaught exception 'NSFileHandleOperationException'

I am trying to dowload simultaneously several files from my own server while using this code : - (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { // create [[NSFileManager defaultManager]…
Elias Rahme
  • 2,226
  • 3
  • 28
  • 53
2
votes
2 answers

create an empty file of specific size and write new data to specific position with fseek

I am new to ios I have 10 chunks of 1024 bytes. this chunks are not in order. If i know the number of chunk how can i insert the data in a file of size 10*1024? So far i have the following code: //method called when new chunk arrvies NSArray…
just ME
  • 1,817
  • 6
  • 32
  • 53
2
votes
1 answer

EXC_BAD_ACCESS when using the same NSFileHandle object in a Cordova plugin

I'm experiencing an access problem in my Cordova plugin: my NSFileHandle "loses" context between Cordova calls, and I end up with either an EXC_BAD_ACCESS, a SIGABRT or an Unrecognized Selector sent to instance error. Debugging and digging inside…
2
votes
2 answers

NSSearchPathForDirectoriesInDomains NSUserDomainMask

Using URLConnection I am downloading a file from a url and storing that data to file in documents directory. When I receive response, when the didReceiveResponse: method called, I create file and move to end of that file this way: NSString…
aparna
  • 353
  • 2
  • 3
  • 13
2
votes
2 answers

Python: File Handler Issue: Delete file without leaving .nsf files

I have following method to handle logging in my python program def createLogger(logger, logLang): """ Setting up logger """ log_format = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") file_handler =…
add-semi-colons
  • 18,094
  • 55
  • 145
  • 232
1 2
3
9 10