Thread: searching and deleting

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    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

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    88
    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
    Hope you don't mind my bad english, I'm Austrian!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  2. about searching and deleting files?
    By jawwadalam in forum Windows Programming
    Replies: 6
    Last Post: 06-07-2003, 09:15 AM
  3. Searching for file, than deleting it.
    By Machewy in forum C++ Programming
    Replies: 2
    Last Post: 06-06-2003, 07:30 AM
  4. Deleting from Binary search trees
    By lenicush in forum C Programming
    Replies: 6
    Last Post: 03-13-2002, 01:40 PM