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
0
votes
2 answers

Why can't this switch statement make any matches against input from the console?

In order to get more familiar with Swift I put together the start of a class designed to represent the needs and wants of a human game character. Right now it keeps track of a water and food variable. These variables are changed by functions that…
acochetti
  • 3
  • 2
0
votes
1 answer

Why I use NSFileHandle read file line by line,the memory usage grows higher and higher?

When I use DDFileReader from How to read data from NSFileHandle line by line? to read a large file (about 37M),the memory usage grows higher and higher. DDFileReader * reader = [[DDFileReader alloc] initWithFilePath:[[NSBundle mainBundle]…
yun huang
  • 11
  • 3
0
votes
2 answers

Execution stopped at readDataToEndOfFile method in iOS

App execution stopped/hang after "readDataToEndOfFile" method executes. Please find the below code, how to fix this issue - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a…
Sudheer Kumar Palchuri
  • 2,919
  • 1
  • 28
  • 38
0
votes
2 answers

Send more than 32768 Bytes at once from one TCP-Socket to an other

Hey guys, I don't know if this question has been asked yet but imagine following situation: I have two TCP-Sockets (opened with NSSocketPort und listening with two NSFileHandle) and now I want to send some NSData between them. @try { [fileHandle…
papr
  • 4,717
  • 5
  • 30
  • 38
0
votes
2 answers

in cocoa,Aout serial communiction using nsfilehandle issues

i have a software about serial communication , it to be develop in MAC os=10.5.8 using cocoa 's nsfilehandle , test ok , but when MAC os upgrading to 10.6 ,the program work no normal, can't receive nsfilehandle's notification . it's why ,
GigaJin
  • 1
  • 1
0
votes
2 answers

NSFilehandle and replace a line

I have a comment about how I should handle a csv file in my application. CSV file will be saved as comma separated, eg customer1, telephone1, mail1, / n customer2, telephone2, mail2, / n and so on I have succeeded. I have also succeeded with the…
Stekarn
  • 11
  • 1
0
votes
2 answers

How to determine if a write operation is successful using NSFileHandle?

The method -writeData: of NSFileHandle class returns nothing. Is there any way for us to determine whether the operation is successful or not? Or I should use other way to save my data?
Andrew Chang
  • 1,289
  • 1
  • 18
  • 38
0
votes
0 answers

Fast way to write data to multiple files - Objective-C OSX

Currently, I'm serially creating/writing data to ~30,000 files using this code: if ([[NSFileManager defaultManager] fileExistsAtPath:[_output_url path]]) { //file already exists, append string to it NSFileHandle *aFileHandle =…
objectiveccoder001
  • 2,981
  • 10
  • 48
  • 72
0
votes
1 answer

Read directly from Asset URL

I am trying to read the contents of an Asset URL directly without writing to the sandbox first. If i write to the sandbox I can read the contents using NSFileHandle *readFile = [NSFileHandle fileHandleForReadingFromURL:file error:nil]; but i am…
lost found
  • 329
  • 1
  • 3
  • 12
0
votes
3 answers

How to insert data to text file with using NSFileHandle

My code replaces text instead of inserting it starting from 5 symbol: NSFileHandle *file = [NSFileHandle fileHandleForUpdatingAtPath: filePath]; [file seekToFileOffset: 5]; [file writeData: [value dataUsingEncoding:NSUTF8StringEncoding]]; Is there…
Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162
0
votes
1 answer

How to get the file's created, modified dates and the kind of the file using NSFileHandle?

How to get the file's created, modified dates and the kind of the file using NSFileHandle? please help me out with this question. i tried with NSDate, but dint find the solution.
0
votes
2 answers

Set NSFileHandle seekToFileOffset to end of line

What I want to be able to do is write a string to the end of every line in a file. Right now i have a NSFileHandle writing to the file but only at the end of the file. How can I set it to the end on the line?
delke
  • 39
  • 2
0
votes
1 answer

How to NSFileHandle a file got from another app

I'm currently trying to implement the opening file from another app. When I got to a third party app (like documents) and opening a file with my app, I can't seems to be able to open it with NSFileHandle. After the AppDelegates method is called : -…
TheSquad
  • 7,385
  • 8
  • 40
  • 79
0
votes
1 answer

Is there any performance difference between creating an NSFileHandle for a large versus a small file?

This question strikes me as almost silly, but I just want to sanity check myself. For a variety of reasons, I'm welding together a bunch of files into a single megafile before packing this as a resource in my iOS app. I'm then using NSFileHandle to…
Brian Rak
  • 4,912
  • 6
  • 34
  • 44
0
votes
1 answer

iOS - NSFileHandle availableData hangs only when app is run manually on device

I have a file handle set up to read the contents of stdout, and when I try to pull the data out of it using availableData it hangs, but only when the app is run manually on my device. When I run the app on my device through Xcode or on the…
JMLdev
  • 846
  • 2
  • 10
  • 21
1 2 3
9
10