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.
Questions tagged [nsfilehandle]
139 questions
1
vote
1 answer
NSFileHandle weird problem with iphone
i am downloading an mp3 file using NSURLConnection and saving it to a file . The problem is mp3 file is created (found the mp3 file created when using simulator), but i cannot access the mp3 file . Any ideas?!!!!!
This is the code i'm using
filename…

iphonemobdev
- 11
- 2
1
vote
1 answer
NSFileHandle fileHandleForWriting returns nil, error code 24
I've got a method in my app that writes a string to the end of a file:
-(void)log:(NSString *)str
{
if (![[NSFileManager defaultManager] fileExistsAtPath:self.logPath])
[[NSFileManager defaultManager] createFileAtPath:self.logPath contents:nil…

Tom Hamming
- 10,577
- 11
- 71
- 145
1
vote
1 answer
Stale NFS file handle issue on a remote cluster
I need to run a bunch of simulations using a tool called ngspice, and since I want to run a million simulations, I am distributing them across a cluster of machines (master+ a slave to start with, which have 12 cores each).
This is the command:…

Nanditha
- 309
- 1
- 6
- 14
1
vote
1 answer
How can I catch EPIPE in my NSFIleHandle handling?
I'm having a problem with EPIPE in my iOS app, and it's not being caught in the @try/@catch/@finally block. How can I catch this signal (SIGPIPE, likely)...
I've built a "web proxy" into my app that will handle certain kinds of URLs - in this error…

Cubs Fan Ron
- 687
- 6
- 17
1
vote
0 answers
Terminating NSTask with NSFileHandle set for standard output
I have a batch of code that creates and runs an NSTask instance. Before running I set, for the standard output of the task, a NSFileHandle witch writes directly to a file I have created.
Sometimes the NSTask is terminated by code (by sending the…

Alex
- 5,009
- 3
- 39
- 73
1
vote
1 answer
NSFileHandle and scanf not echoing input in Xcode 4.5
I successfully use NSFileHandle to read keyboard input:
NSFileHandle * keyboard = [NSFileHandle fileHandleWithStandardInput];
NSData *inputData = [keyboard availableData];
NSString * input =[[NSString alloc] initWithData:inputData…

soundsmitten
- 90
- 2
- 8
1
vote
2 answers
Objective C print stdout to UIAlertView
I have a C function that prints to stdout using fprintf, and I'm attempting to display the contents of stdout in a UIAlertView. My code is as follows:
NSFileHandle *stdoutFileHandle = [NSFileHandle fileHandleWithStandardOutput];
NSData *stdoutData…

JMLdev
- 846
- 2
- 10
- 21
1
vote
1 answer
Can someone help me spot a leak in this NSPipe/NSFileHandle code?
So I'm having this issue where once this NSFileHandle/NSPipe gets triggered... my CPU use and memory start going crazy. Problem is I'm finding it hard to find this leak. Any advice or help is appreciated. Cheers.
.h
NSTask *task;
NSPipe…

crewshin
- 765
- 9
- 22
1
vote
1 answer
Not able to edit first byte of file using NSFileHandle
In my app, I am using NSFileHandle to edit some file but it is not editing.
Below is the code: with comments & logs output
//Initialize file manager
NSFileManager *filemgr;
filemgr = [NSFileManager defaultManager];
//Initialize file…

Dilip Lilaramani
- 1,126
- 13
- 28
1
vote
1 answer
Clang NSTask with streams
Never-mind all the "why?","useless?", and "don't bother" comments. I want to compile a program inside another program using clang. I can create the NSTask and set up the arguments and it will work if the file exists, (ie. no stream), and writes to a…

utahwithak
- 6,235
- 2
- 40
- 62
0
votes
2 answers
Modifying Data (bytes) in a File iOS
I have a huge encrypted file(mp4) about 700MB. Header of file is encrypted about (1MB+dummy bytes). The decryption of this file is done successfully.
Now i want to remove the (1MB+dummy) encrypted bytes in file (same file) & replace them with…

Pranav Jaiswal
- 3,752
- 3
- 32
- 50
0
votes
0 answers
Reading NSTask output persistent memory usage
I have a simple NSTask which runs a shell command, and a NSPipe file handle for reading which is used to read the output of the command and writes out to a file. When this command terminates and the output is written to file, Activity Monitor and…

DannyBoi8181
- 33
- 4
0
votes
1 answer
Reading float from a custom file
I want to read some float value one by one from a custom file I defined "player.geo".
player.geo is a file I created using Xcode 4 ("Empty File" from the File > New menu)
I'm currently trying to do it like this:
- (id) initWithGeometryFile:(NSString…

Zhang
- 11,549
- 7
- 57
- 87
0
votes
1 answer
getting an error when trying to use seekToFileOffset
I am currently trying to read a line of 5 characters from a offset in my text file.
I am pretty sure everything is working however when I print the contence of my buffer to the log, it outputs this <7466315c 61>
- (void)fetchCode:(id)sender{
…

tinhead
- 385
- 2
- 10
- 29
0
votes
1 answer
how to open text file with NSFileHandle
I am trying to open a small text file to test some NSFileHandle functions on the file. however I cannot figure out how to do this, if you could tell me what I am missing that would be great.
//.h
@interface MainViewController : UIViewController…

tinhead
- 385
- 2
- 10
- 29