#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Location
    HYD
    Posts
    2
    Rep Power
    0

    trying to resolve types - help me!!!


    Hi guys,

    I need to check from a sample cpp program if the foll. declaration exists:
    const int *x = new const int;
    it has to be replaced as
    const int *x = new const int(3);

    Problem is if it exists only once in the prg script is working fine.
    for multiple occurences there is a problem

    used grep cmd to search and then used cut to get the type and then used sed to replace

    Plz let me know soon
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,782
    Rep Power
    4301
    Can you use a perl script instead. I might have one lying around that does find/replace on multiple files.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Location
    HYD
    Posts
    2
    Rep Power
    0

    no can't use perl


    Hi

    Thanks for ur reply.But, we can't use PERL.

    I tried to read the sample code line by line using a temp file
    and then within the while structure i used a case structure for the various occurrences of int,float,double .

    with the help of sed statement i replaced new const int with new const int(3) using a variable for the default value.

    Problem is only the last done replacement is there. rest everything is overwritten.

    What should i do????

IMN logo majestic logo threadwatch logo seochat tools logo