Lesson Learned [27/08/2014]

1. File Read 
#include <fstream>
int main(int argc, char *argv[]){
   ifstream input_file;
   ofstream output_file;

   input_file << T;
   input_file << N;

      the file pointer does not move to the next line, it may be at a newline char 
      subsequent getline will read a empty and the first array element would be empty
   input_file << std::ws; //discard whitespace if we are sure that it is a whitespace char at the current pointer
   for(unsigned int elem = 0; elem < N; elem++){
       input_file.getline(data,100/*read 100 chars*/);
   return 0;


Popular Posts