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.

351 questions
58
votes
2 answers

writeToFile:atomically: what does atomically mean?

I am wondering what the atomically: parameter stands for in the writeToFile:atomically: method (-[NSArray writeToFile:atomically:] for example). It is common to pass YES for atomically:, but I don't know what it means.
JonasG
  • 9,035
  • 12
  • 53
  • 88
24
votes
8 answers

Xcode: directory file for simulator Iphone

i want to write a string in a file "file.txt": this file in my project (for Iphone) is inside Resources; I try to write a string in this file but it don't work, I show my code. NSArray *paths =…
cyclingIsBetter
  • 16,737
  • 47
  • 149
  • 236
21
votes
8 answers

how to use writeToFile to save image in document directory?

// directoryPath is a URL from another VC @IBAction func saveButtonTapped(sender: AnyObject) { let directoryPath = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as NSURL …
Nishad Arora
  • 255
  • 1
  • 2
  • 10
11
votes
7 answers

How to efficiently write to file from SQL datareader in c#?

I have a remote sql connection in C# that needs to execute a query and save its results to the users's local hard disk. There is a fairly large amount of data this thing can return, so need to think of an efficient way of storing it. I've read…
Sam
  • 836
  • 3
  • 10
  • 21
10
votes
2 answers

NSData writeToFile not working

I cant seem to get nsdata to write to a file. Any ideas what i may be doing wrong. Thanks in advance. NSString* filename = @"myfile.txt"; NSString *applicationDocumentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,…
user346443
  • 4,338
  • 13
  • 53
  • 75
8
votes
1 answer

How to write a pandas dataframe to CSV file line by line, one line at a time?

I have a list of about 1 million addresses, and a function to find their latitudes and longitudes. Since some of the records are improperly formatted (or for whatever reason), sometimes the function is not able to return the latitudes and longitudes…
Kristada673
  • 2,895
  • 3
  • 21
  • 59
7
votes
2 answers

Writing to text file in swift 3

I am trying to write data that is inputted by a user via UITextField to a text file. I am successfully able to do this by the code I have written below. However, when I tried to save more data it will replace the existing data in the textfile with…
Aneesa
  • 113
  • 3
  • 10
7
votes
1 answer

Json file to powershell and back to json file

I am trying to manipulate json file data in powershell and write it back to the file. Even before the manipulation, when I just read from the file, convert it to Json object in powershell and write it back to the file, some characters are being…
Romonov
  • 6,675
  • 10
  • 39
  • 53
7
votes
2 answers

Why can't I append a String to a NSURL?

Appending the .txt file component to the URL path doesn't work: var error:NSError? let manager = NSFileManager.defaultManager() let docURL = manager.URLForDirectory(.DocumentDirectory, inDomain:.UserDomainMask, appropriateForURL:nil, create:true,…
Frederick C. Lee
  • 7,609
  • 13
  • 56
  • 89
6
votes
3 answers

Writing Unicode to a file in C++

I have a problem with writing unicode to a file in C++. I want to write to a file with my own extension a few smiley faces that you can get by typing ALT+NUMPAD(2). I can display it on CMD by making a char and assigning the value of '\2' to it and…
Garrett Ratliff
  • 181
  • 3
  • 4
  • 10
5
votes
1 answer

Writing dictionary of dataframes to file

I have a dictionary, and for each key in my dictionary, I have one pandas dataframe. The dataframes from key to key are of unequal length. It takes some time to get to the dataframes that are connected to each key, and therefore I wish to save my…
C. Refsgaard
  • 187
  • 2
  • 10
5
votes
0 answers

How to use synthesizeToFile in android API 21 and above

spoken1 = new TextToSpeech(getApplicationContext(), new TextToSpeech.OnInitListener() { @Override public void onInit(int status) { if(status != TextToSpeech.ERROR){ spoken1.setLanguage(Locale.US); …
5
votes
2 answers

How to write numpy arrays to .txt file, starting at a certain line?

I need to write 3 numpy arrays into a txt file. The head of the file looks like that: #Filexy #time operation1 operation2 The numpy arrays look like the following: time = np.array([0,60,120,180,...]) operation1 =…
Matias
  • 521
  • 1
  • 4
  • 12
4
votes
0 answers

Opencsv, StatefulBeanToCsv write nested List of Objects to csv

I have to write nested list of objects(StoreLocations) into Csv file using open csv. My model classes are- public class StoreLocation { private String name; private String city; private int zip; private String streetAndNumber; …
Caffeine Coder
  • 344
  • 1
  • 11
4
votes
2 answers

NSManagedObject hierarchy import and export

I'm on the run to make my NSMangedObjectClass profile im-/exportable. I try it this way Exporting works correctly if I write the Relationships in NSArrays because NSSet doesn't have writeToFile implemented. - (void) exportProfile:(Profile…
Seega
  • 2,502
  • 1
  • 28
  • 44
1
2 3
23 24