Questions tagged [writetofile]

for questions concerning the writeToFile method, part of the NSData class in OS X and iOS

This tag should be used for questions that relate to the use of one or more of the various writeToFile methods, which are provided by the NSData class in both the Mac OS X and iOS APIs.

The Apple developer documentation for the NSData class is available online here.

370 questions
0
votes
1 answer

Error while writing unicode data to file

I am trying to write unicode data(The actual data contains german characters) to a file but I am getting error: Traceback (most recent call last): File "C:\Python27\extract_osm_road_nw.py", line 76, in
tanzil
  • 1,461
  • 2
  • 12
  • 17
0
votes
2 answers

Reloading NSArray of NSStrings From File

I have an NSArray of NSStrings that I am saving to file and then reloading from file when the app is relaunched. Strangely though, the strings have parenthesis around them after they are reloaded. I save via: writeToFile:atomically: and I load the…
daveMac
  • 3,041
  • 3
  • 34
  • 59
0
votes
1 answer

setObject doesn't work within one of the classes

I'm trying to make a 'saveState' method with implementation (in blablabla.m): -(void)saveState { NSString *masterCode = [[NSString alloc] initWithString:first]; masterCode = [masterCode stringByAppendingString:second]; masterCode = [masterCode…
Dmitrii Malyshev
  • 629
  • 9
  • 12
0
votes
1 answer

error while trying print to several files in bash scripts

I've got a problem related to write to files. I've created server/client in c (for Linux, via sockets). I want the clients to save a log file with all the actions they did. When I open a client and transfer file everything is OK but when I check my…
Yoav Amir
  • 23
  • 1
  • 3
0
votes
1 answer

Page Refreshes with Incorrect Content After Writing to File

I've got a PHP page that reads a text file from the server and loads some content on the page based on the contents of that file. Then, when the user clicks a submit button, content is rewritten to the text file and the page is reloaded. However,…
JToland
  • 3,630
  • 12
  • 49
  • 70
0
votes
1 answer

Writing to .plist returns "Success!" but ends up blank

Here is my code: -(IBAction)btnSaveInfo:(UIButton *)sender { NSMutableArray *data = [[NSMutableArray alloc] init]; NSDictionary *appInfo = [NSDictionary dictionaryWithObjectsAndKeys: fieldAPI.text, @"App API", fieldID.text, @"App ID",…
1789040
  • 569
  • 2
  • 6
  • 17
0
votes
2 answers

How to explode a line in text file and write a new value for second part of it using PHP

I'm trying to change values in atext file after "=", explode returns an array of two elements, I want the second element to be replaced with a new value and then written in my file, but I'm lost with syntax !! $trID_Log_File = $fileName; …
SafeY
  • 287
  • 2
  • 6
  • 18
0
votes
1 answer

writing Bytes into a .Bin file

I have a vector in C++ that I want to write it to a .bin file. this vector's type is byte, and the number of bytes could be huge, maybe millions. I am doing it like this: if (depthQueue.empty()) return; FILE* pFiledep; pFiledep =…
user667222
  • 179
  • 3
  • 16
0
votes
1 answer

writing NSData to file, get error unrecognized selector sent to instance

I have problem to write data to file. What I'm doing wrong? SecTrustRef trust = [protectionSpace serverTrust]; SecCertificateRef certificate = SecTrustGetCertificateAtIndex(trust, 0); NSData* ServerCertificateData = (__bridge NSData…
kubo
  • 492
  • 7
  • 19
0
votes
2 answers

Objective-C: writing values to a specific index of an Array inside a .plist

I understand I can for instance write a value to a .plist file as such NSString *filePath = [[NSBundle mainBundle] pathForResource:@"stored" ofType:@"plist"]; NSString *comment = @"this is a comment"; [comment writeToFile:filePath…
Taskinul Haque
  • 724
  • 2
  • 16
  • 36
0
votes
1 answer

Why WriteToFile method does not works in (IBAction)btnClicked:(id)sender?

the following is my source code: /--'fileName' is an available filePath.--/ NSLog(@"%@", @"v-log start"); NSMutableArray *txtArray = [[NSMutableArray alloc] init]; [txtArray addObject:@"test"]; [txtArray writeToFile:fileName…
snowMan
  • 23
  • 3
0
votes
1 answer

writeToFile fails when writing to desktop

I have this code snippet below. The purpose is to write the contents of an array to a plist file. When I run this I don´t get any errors and everything seems to be fine. The problem is that the file doesn´t appear on the desktop. I used writeToFile…
Ronald Hofmann
  • 1,390
  • 2
  • 15
  • 26
0
votes
1 answer

Unable to download file to app directory in iPhone

I am new to iPhone, I am currently developing an iPhone app and would like to implement the ability to download file from the url. I have created the UIWebView, when i click on download link in the webview download will start and i am saving that…
Krunal
  • 6,440
  • 21
  • 91
  • 155
0
votes
1 answer

Download file to app directory in iphone

I am new to iPhone, I am currently developing an iPhone app and would like to implement the ability to download file from the internet. I have created the UIWebView, but want to know the best way of capturing the files when they are linked to in the…
Krunal
  • 6,440
  • 21
  • 91
  • 155
0
votes
2 answers

How can i create a new string using string modifiers in C++?

I want to write a timestamp to a file in a certain format. Is there a way to create a new string using modifiers (see printf code below)? Or is there another way to use string modifiers in a TextStream? printf("%02d-%02d-%02d_%02d:%02d:%02d.%02d\n",…
Makaku00
  • 121
  • 5
  • 14