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 863653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:20:55+00:00 2026-05-15T09:20:55+00:00

I have several large word lists and I had been loading them in place

  • 0

I have several large word lists and I had been loading them in place in the code as follows:

NSArray *dict3 = [[NSArray alloc] initWithObjects:@"abled",@"about",@"above",@"absurd",@"absurdity", ...

but now it is actually causing an exc_bad_access error weirdly, i know it seems implausible but for some reason IT IS causing it. (trust me on this I just spend the better part of a day debugging this crap)

Anyway, I’m looking to get these humongous lines of code out of my files but I’m not sure what the best approach is. I guess I could do a plist but I need to figure out how to automate the process.

it be easiest if I could just use the text files I’ve been compiling so if anyone knows how I can format the text file so that the

myArray = [NSArray arrayWithContentsOfFile: @"myTextFile.txt"];

will be read in correctly as one word per element in the array it would really be appreciated.

  • 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-05-15T09:20:56+00:00Added an answer on May 15, 2026 at 9:20 am

    I ended up scavenging through a friends code and found my answer, nice little piece of code actually:

    - (NSArray *) readFile:(NSString *) path {
    
    
    NSString *file = [NSString stringWithContentsOfFile:path];
    
    NSMutableArray *dict = [[NSMutableArray alloc] init];
    NSCharacterSet *cs = [NSCharacterSet newlineCharacterSet];
    NSScanner *scanner = [NSScanner scannerWithString:file];
    
    NSString *line;
    while(![scanner isAtEnd]) {
        if([scanner scanUpToCharactersFromSet:cs intoString:&line]) {
            NSString *copy = [NSString stringWithString:line];
            [dict addObject:copy];
    
        }
    }
    NSArray *newArray = [[NSArray alloc] initWithArray:dict];
    
    return newArray;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there have been several posts about random word generation based on large
I have several large code bases which compile into dynamic libraries. I know that
I have several large (200+ lines) of HTML that I need to place in
I have several large DTD files. I've used trang to convert them into XSD
I have several large text files (30m+ lines, >1GB) which are being processed in
Let's say I have a somewhat large (several millions of items, or so) list
I have a large class, which I have divided into several different class extension
I have a large table (of sites) with several numeric columns - say a
I have a large body of text which has several sentences wrapped in yada
I have a pretty large site and every page is built from several included

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.