Skip to content
Snippets Groups Projects
Commit b1c28bdf authored by Mathieu Valois's avatar Mathieu Valois
Browse files

Fix wrong line fetching. Use getline instead

parent d6251be8
No related branches found
No related tags found
No related merge requests found
Pipeline #6315 passed
...@@ -82,7 +82,7 @@ int Statsgen::generate_stats() { ...@@ -82,7 +82,7 @@ int Statsgen::generate_stats() {
if (is_stdin){ if (is_stdin){
string line; string line;
nbline = 0; nbline = 0;
while(cin >> line){ while(getline(cin, line)){
td[nbline%nbThread].password_queue.push(line); td[nbline%nbThread].password_queue.push(line);
nbline++; nbline++;
} }
...@@ -310,7 +310,7 @@ void* generate_stats_thread(void* threadarg) { ...@@ -310,7 +310,7 @@ void* generate_stats_thread(void* threadarg) {
string password; string password;
uint64_t nbPasswords; uint64_t nbPasswords;
while(readfile >> line){ while(getline(readfile, line)){
++nbline; ++nbline;
if (nbline < my_data->lineBegin){ continue; } if (nbline < my_data->lineBegin){ continue; }
if (nbline > my_data->lineEnd){ break; } if (nbline > my_data->lineEnd){ break; }
...@@ -338,7 +338,7 @@ uint64_t nbline_file(const string & filename) { ...@@ -338,7 +338,7 @@ uint64_t nbline_file(const string & filename) {
string line; string line;
uint64_t nb = 0; uint64_t nb = 0;
while(readfile >> line){ while(getline(readfile, line)){
++nb; ++nb;
} }
// we have not read the whole file // we have not read the whole file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment