How do I open a file and store the contents of that file into a character array?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TRkats
    New Member
    • Jan 2014
    • 1

    How do I open a file and store the contents of that file into a character array?

    I am trying to store a large text file into an array so I can count the number of characters.
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    Might the text file be so big that your program can't allocate enough RAM to hold it? If so, then you'll need a different approach.

    Is you only interest counting the number of characters in the file? You can do that without constructing an image of the entire file in an array.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      Are you using C++? Or C ?

      Comment

      Working...