I'm going directly to the question. I make it with reading a files line by line and then merge the strings but need a good explanation how to do it with vectors. My goal is to use a system command (Windows XP, 7) to check directory contents and send them directly to the 'vector sysoutp' as example and then merge it in new file with information from a second file. Any ideas?
Just for example part of my code:
while (getline(myinputfile, line))
{
lines++;
found = line.find(countchars);
if (found!=string::npos)
{
line.erase(int(found) + 4);
myoutputfile << line << endl;
}
}
where myinputfile is filled with 'syscomm', the idea is to be converted with vectors but apparently when I try to do something like getline(cin, tmp)
where 'cin' is syscomm nothing happens (well, errors pop-up) :(
Also I have and an error when using this preproccessor directive
#define syscomm system("dir /b | find /i /v ".exe .txt")
:
createlist.cpp|15|warning: missing terminating " character [enabled by default]|
createlist.cpp|53|error: missing terminating " character|
createlist.cpp||In function 'int main()':|
createlist.cpp|53|error: request for member 'exe' in '"dir /b | find /i /v "', which is of non-class type 'const char [21]'|
||=== Build finished: 2 errors, 1 warnings ===|
It's working without adding "| find ..." but using it I can filter not needed file names with their known extensions.
Thanks for cooperation and sorry for 2-in-1 question pack :)