Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:17:35+00:00 2026-06-08T18:17:35+00:00

The code I have right now looks like this: NSString *path = @/Users/student/Desktop/conf.txt NSArray

  • 0

The code I have right now looks like this:

NSString *path = @"/Users/student/Desktop/conf.txt"

NSArray *myArray = [NSArray arrayWithObjects:@"hello",@"world",@"etc",nil];

[myArray writeToFile:path atomically:YES];

When I look at the text file it writes it ends up looking like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"     "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
    <string>hello</string>
     <string>world</string>
    <string>etc</string>
 </array>
 </plist>

I don’t want to display it as an html, I just want a simple text document with the 3 lines saying, “hello world etc”.

Does anybody know how I could fix this?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:17:37+00:00Added an answer on June 8, 2026 at 6:17 pm

    If your array contains strings and you wat to write them to file one per line you can first create string with all your words and then write it to file:

    NSString *outString = [myArray componentsJoinedByString:@"\n"];
    NSError *error = nil;
    [outString writeToFile: path atomically:YES encoding:encoding:NSUTF8Encoding error:&error];
    

    But if you want to serialize your array for future use plist format may be more convenient

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, I have code that looks something like this: Timer timer = new
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
Right now, I have my code looking like this: SqlTables.java: // Separate file public
Right now my code looks like this: <script type=text/javascript> $(document).ready(function() { $.ajaxSetup({ cache: false
Right now, if you have a test that looks like this: [TestMethod] [DeploymentItem(DataSource.csv)] [DataSource(
In my code right now I have something like this: state.BytesRead += readPacket.Result; if
I have this code right now to get the row value from jquery grid..
Right now, I have this code where $obj_arr maybe contain array and an object.
i have some code that looks like this and creates a list from an
I have code which parses XML that looks like this: <custom_fields> <custom_field> <column_name>foo</column_name> <column_value>0</column_value>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.