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
1 answer

Cocoa Createfileapath

I am trying to create a file on mac os. the data from the file will be accessed by the app. but how to create a file having read permission on all accounts. Currently the app can read data in admin account only. I am using following syntax: BOOL B…
Aniket
  • 131
  • 1
  • 3
  • 9
0
votes
2 answers

Swift: Creating a csv file in Documents Directory

I am creating a registration form application. The registration form data will be saved in a CSV file. I need to create a csv file in the documents directory and be able to write to it. I'm pretty new to Swift so I'm having a bit of trouble. This is…
Alex Cauthen
  • 497
  • 5
  • 12
  • 32
0
votes
2 answers

Optimize memory consumption when gradually writing to a file

I've been doing some tests, and one of my needs is to read data from different xml files and stack it together on a single file. While I've managed to accomplish this, memory consumption seems to be quite large for the task, the iphone simulator…
wintermute
  • 433
  • 2
  • 12
0
votes
1 answer

Attach text at the beginning of the file

I am trying to add some text at the beginning of my text file. I am currently trying to create NSFileHandle and seek to fileOffset, but it overwrites my data (as expected). How can I add it at the beginning? NSArray *paths =…
izik461
  • 1,131
  • 12
  • 32
0
votes
1 answer

iOS 9 - Swift - Writing data to a FileStorage - word "Optional" is prefixed for every field

Trying to write data from UI to IOS File Storage : @IBAction func savetoFile(sender: AnyObject) { let csvLine:String="\(bookName.text), \(bookAuthor.text),\(bookIsbn.text)\n" let paths = NSSearchPathForDirectoriesInDomains( …
0
votes
0 answers

Getting Output from NSTask that has Multiple Threads Printing Output

I have an Xcode app (written in Swift, though that should be irrelevant) that starts a console application (i.e. Terminal application that is written in C++) and expects to read the output from its Standard and Error outputs. The task prints from…
P.M.
  • 436
  • 6
  • 12
0
votes
1 answer

writeToFile fails with error = null

I have an app running in the XCode simulator (v6.4); this is the pertinent code: NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; // read the file back…
SpokaneDude
  • 4,856
  • 13
  • 64
  • 120
0
votes
1 answer

NSFileHandle for binary files?

How can we read executable files in memory and then manipulate them , does NSFileHandle can works with executable files and how so ?! Thank you.
SubWary
  • 1
  • 1
0
votes
0 answers

How to use [NSFileHandle fileHandleForReadingAtPath:url]?

I want to pass assets URL NSURL *url = [NSURL URLWithString:@"assets-library://asset/asset.PNG?id=1000000001&ext=PNG"]; NSFileHandle *fileHandle = [NSFileHandle fileHandleForReadingAtPath:url] NSLog(@"fileHandle: %@", fileHandle); I am getting…
Swapnil1156035
  • 361
  • 1
  • 11
0
votes
1 answer

Sending large amounts of data with NSFileHandle

So I'm using Apple's PictureSharing/PictureSharingBrowser samples to send and receive data. This uses an NSFileHandle on the server side to send a picture using NSFileHandle's writeData method. NSFileHandle * incomingConnection = [[aNotification…
Patrick
  • 1,079
  • 1
  • 9
  • 14
0
votes
1 answer

iphone charset howto

i've a class (downloaded from internet) that read a value of a file in this way (and after split the file): NSArray* array = [fileContents componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; where fileContents…
zebra
  • 435
  • 2
  • 8
  • 20
0
votes
0 answers

How read fragmented media data in iOS

I have developed an iOS application which can records videos for long durations , i have used AVCaptureSesssion to use recording But now i want to split recorded media data according to timestamp and i thought of doing this according to following…
Mr.G
  • 1,275
  • 1
  • 18
  • 48
0
votes
1 answer

echo Does Not Work with NSTask and readInBackgroundAndNotify

I have the following Obj-C code and its log output. Can anyone tell me why I'm not getting any output from the NSFileHandle? @implementation AppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { [self…
Shun Y.
  • 103
  • 1
  • 6
0
votes
1 answer

What's the advantages of using NSOutputstream?

I need to download large files from the Internet , and save it to local disk. At first, i save the data like this: - (void)saveToLocalFile:(NSData *)data withOffset:(unsigned long long)offset{ NSString* localFile = [self tempLocalFile]; …
foogry
  • 835
  • 7
  • 17
0
votes
3 answers

How can I replace 12 byte data from a local file?

My App would download a file which the first 12 byte data was encrypted,so I have to read this file from Document and decrypt the first 12 byte data. My first try was to read the whole file and decrypt it then write to file again. but if the file is…
johnMa
  • 3,291
  • 24
  • 37