.net - Reading binary files -
although suspect know answer, interested in people's responses.
currently, have vc6 app running on w2k3 reads text file using following(simplified code):
string line; ifstream infile("test.txt",ios::in); while (!infile.eof()) { getline(infile,line); } ...
each record in file has fields pipe delimited , code works fine crlf, although fields , records not fixed length. issue file going binary due data being unsigned packed decimal in addition text. basically, code above still valid if opened binary file(delimiters , lf retained)? tried quick test dummy data , appeared behave same.
it understanding binary files read w/the knowledge of data content bytes can retrieved , w/o lf's. i've searched around web , found various options c++ , other .net languages(an option), none seem capable of reading 1 line @ time -- if variable sized data , lf seem defeat purpose of using binary file -- , not want read entire file in 1 shot since quite large(hoping not read 1 char @ time either).
so if above might valid, there risk of data loss? if not, other options appreciated. , if missing here, please feel free elaborate.
if rely on rows being limited crlf if binary data has crlf you'll false line break. also, if binary data contains value 124 (vertical pipe) you'll have issues determining columns.
Comments
Post a Comment