c# - Read All Bytes Line By Line In .txt -
i need read in bytes on 1 line , throw them array, , move onto next line , on , forth.
for instance:
.txt file
word apple zzz
now in program have read in first line bunch of bytes, , array consist of 4 elements. i'd processing , move on next line , on.
i have looked in many places no luck. ideally, need readallbytes()
except instead of reading entire file need read 1 line.
edit: since going speed, cannot readalllines() or anything require me read string first , convert array of bytes.
edit2: have backtrack bit because understand not best @ explaining anything, try. ideally, how code work
loop through lines of txt file loop through bytes on line read byte , process if need to, break loop , move on next line
this give better understand of dilemma.
even though problem remains unsolved i'd still thank tried me: thank trying
assuming text file ascii:
var lines = file.readlines(@"c:\temp\foo.txt"); foreach (var line in lines) { byte[] bytes = encoding.ascii.getbytes(line); // processing byte array }
updated readlines()
based on comments.
Comments
Post a Comment