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

What is the path of photos album on iPhone device?

I was trying to save a PNG file to photos albums folder on the iPhone device with a .png extension so that the transparency remains.. My question is: What is the path of photos album UIImageWriteToSavedPhotosAlbum function is using? I am using data…
tiw
  • 535
  • 1
  • 6
  • 22
2
votes
1 answer

UIImagePNGRepresentation writeToFile can errors be catched?

i render Thumbnails of newly recieved PDF Document to the Documents-Directory. I'm using the following code: CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("thedoc.pdf"), NULL, NULL); CGPDFDocumentRef bookPDF =…
MadMaxAPP
  • 1,035
  • 2
  • 16
  • 39
2
votes
1 answer

ObjC download file and save it to directory

Id like to "update" a local file from a server (save it to a directory). I tried EVERYTHING! NOTHING WORKS! That's my last attempt: NSURL *url = [NSURL URLWithString:@"http://www.doothie.com/QAFrameworks/QAUpdater.php"]; NSData *urlData =…
Smoothie
  • 261
  • 4
  • 11
2
votes
1 answer

Adding lines to allready exisiting file

I am currently working on an optimization problem where I want to add some information from each IPOPT iteration to a file by using a callback function. I am able to collect the information I need but when I try to add it to the file it only adds a…
Annaquest
  • 131
  • 6
2
votes
1 answer

Having trouble trying to add a line to a text file if that line doesn't exist already using Python fileinput.FileInput(...)

I'm trying to edit text files using the Python FileInput class. First I store the lines that i need to write in a Dictionary. Then I iterate through that dictionary, and if the dictionary[key] matches any line in that line, I replace the line with…
user695624
  • 123
  • 1
  • 8
2
votes
1 answer

writeToFile not working on NSDictionary with UIImagePickerControllerReferenceURL inside

I have an NSURL inside a NSDictionary, which looks like this: assets-library://asset/asset.JPG?id=1000000001&ext=JPG This NSURL is from UIImagePickerControllerReferenceURL. Without this object, the NSDictionary saves using this code fine: BOOL…
Andrew
  • 15,935
  • 28
  • 121
  • 203
2
votes
2 answers

Create new file with other name if file name already exist in python

For the moment my script can create a file and the content. However, I would like to have a way in my code to directly noticed if the file already exists, and then if it exists, it creates a new file which will not be Y but Y_2 or Y with the current…
2
votes
2 answers

write a string into file

I have the above code. What i wanna do is to write in a txt file a string. import java.io.*; import java.util.*; public void writeAsfalizomenos(asfalizomenos myObj) throws IOException { Scanner scanner = new Scanner(System.in); …
snake plissken
  • 2,649
  • 10
  • 43
  • 64
2
votes
4 answers

Writing list to file for reuse at a later date

I have a python file that requires a username and password for authentication. These username and passsword details are saved to the file in the format userlist = [[username, password], [username1, password1]] and so on. This works but when I…
Max Davies
  • 148
  • 10
2
votes
2 answers

How to write a file to csv when a column is 'struct' type?

I have an output spark Dataframe which needs to be written to CSV. A column in the Dataframe is 'struct' type and is not supported by csv. I am trying to convert it to string or convert to pandas DF but nothing…
Maleeha
  • 23
  • 1
  • 3
2
votes
3 answers

NSDATA writeToFile crashes without a reason

I am downloading images from a url using NSDATA and saving them to local file system using NSData *dataForStorage = [NSData dataWithData:UIImagePNGRepresentation(img)]; BOOL saveResult=[ dataForStorage writeToFile:jpegFilePath…
2
votes
2 answers

How to write data to a text file in Flask?

Our goal is to write a variable called "inputed_email" into a text file named "test3.txt". Because this takes place on the server, we need to make sure that this Python script can access the directory and text file. @app.route('/', methods=['GET',…
Evan Yang
  • 125
  • 1
  • 8
2
votes
2 answers

iOS Write Data to file, FILE DOES NOT EXIST

I'm tryin to write the datas of an Image in the cacheDirectory, like this : let imageData = UIImageJPEGRepresentation(image, 1.0) else { fatalError("Impossible to read the image") } try! imageData.write(to: cachedImageURL, options:…
Alexis Darnat
  • 581
  • 6
  • 13
2
votes
0 answers

read write file to 5 decimal places in borland c++

I writing with borland C++ compiler. I want to read numbers with 5 decimal places from text file then save it into another text file. I wrote my program as below: main { double Bid[25], Be1[25],Bn1[25]; int i,no=10,j,p; char filename[30]; …
2
votes
1 answer

NSData writeToFile returns NO without any error

I know many topics already exist but none of them seems to enlighten my problem. I am supposed to get a PDF file back from a JSON request on a server. The downloading task process is called but when I try to store my NSData to a file, it does not…
1 2
3
24 25