-
searching and deleting
hiya..
the program i am writting seems to be like some of the others i have seen on here. my problem is this: i have wrote a program that copyies a c++ file from a cpp to a txt file..that part is easy. thats done. next part is i have to take out all comment lines and multi comment lines and white spaces/..
for example.
//this is a comment line
/* this is a comment line */
the program is suppost to take out those line including the // & /**/
not sure how to do that...i figured set it up in an array and check it that way..but from there i am lost. one suggestion was use like malloc or calloc..but not sure how to use them..if anyone could be of help i will put you on my xmas list and have bill gates send you a new car..
thanks
tim
-
OK, I would suggest you to use std::vector declared in <vector>
read the whole file in the vector!
then you can use find() and erase() to delete the comment lines