I'm working on a school project and encountered some difficulties. My program reads a *.txt file containing ls -l instruction and assigns it's lines to char array one at a time.
1 2 3 4 5
getline(file, line);
char *data = newchar[line.length() + 1];
strcpy(data, line.c_str());
//pull out data, convert to int, compare to another variable, if true print out the entire line
delete [] data;
So now I've got a char array, eg.:
1 2
"-rw-r--r-- 1 jendrek Administ 560 Dec 18 2010 CommonTypes.xsd"
/*note that there are multiple space's in the file*/
and what I need to do is I need to pull out the size of the file (eg. 560) from that particular array, convert it to integer and compare it to another variable. This is where I'm stuck. Tried some of my ideas but they failed and now I'm all out. I will be grateful for every piece of advice!