Are text files a long string or an array of shorter strings? -
i have thought text files (.txt) merely long strings , different lines created through inclusion of (an invisible) \n.
however, although not said explicitly, have seen references text files string arrays.
are text files collection of string arrays each line being separate string?
so, instead of text file being:
string = "i went supermarket\ni bought loaf of bread\ni ate bread later day"
are text files really:
string[1] = "i went supermarket" string[2] = "i bought loaf of bread" string[3] = "i ate bread later day"
?
text files, , files in general, logically contiguous sequence of bytes, or otherwise known array. operating system provides abstractions , tools can load parts of array memory on demand.
however, application free load interpret data sees fit, using operating system abstractions of reading random sections of array. if wished treat text file line @ time, making line (delimitated newline character) individual string approach.
Comments
Post a Comment