diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2015-09-05 09:32:30 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2015-09-05 09:32:30 -0400 |
commit | ea76b6988ccafaa6a4d4ed90f2489d0e49e1f180 (patch) | |
tree | b01dd19f5c53406d9d636b18bc49916bfdd6d3bc /g_src/textlines.cpp |
Imported Upstream version 0.40.24upstream/0.40.24upstream
Diffstat (limited to 'g_src/textlines.cpp')
-rwxr-xr-x | g_src/textlines.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/g_src/textlines.cpp b/g_src/textlines.cpp new file mode 100755 index 0000000..e56515a --- /dev/null +++ b/g_src/textlines.cpp @@ -0,0 +1,61 @@ +#include "platform.h" +#include <string.h> +#include <math.h> +#include <iosfwd> +#include <iostream> +#include <ios> +#include <streambuf> +#include <istream> +#include <ostream> +#include <iomanip> +#include <sstream> +#include <cstdlib> +#include <fstream> +#include <zlib.h> + +#include "svector.h" +using std::string; + +#include "endian.h" + +#include "files.h" + +#include "enabler.h" + +#include "textlines.h" + +#include "basics.h" + +extern char filecomp_buffer[20000]; +extern char filecomp_buffer2[80000]; +extern char filecomp_buffer_aux[20000]; +extern char filecomp_buffer2_aux[80000]; + + +void textlinesst::load_raw_to_lines(char *filename) +{ + clean_lines(); + + //LOAD THE FILE + std::ifstream fseed(filename); + if(fseed.is_open()) + { + string str; + + while(std::getline(fseed,str)) + { + long end=str.length(); + + while(end>0) + { + if(isspace(str[end-1]))end--; + else break; + } + + str.resize(end); + + if(str.length()>0)text.add_string(str); + } + } + fseed.close(); +}
\ No newline at end of file |