delete chars until end of line

Discussion in 'C++' started by RicK, Jul 18, 2007.

  1. RicK

    RicK Guest

    Hy guys,

    I'm sorry for my bad english,

    I have a problem writing a text file:

    I have this 2 lines:
    abcd = 0;zzzzzzzzzzzzzzzzzzzz
    fghi = 1;
    and I want delete all next ';' (zzzzzzzzzzzzzzz) but not erase the second
    line;

    regards
    RicK
     
    RicK, Jul 18, 2007
    #1
    1. Advertising

  2. RicK

    Jim Langston Guest

    "RicK" <rmarfisiNOAT@__SPAM_AT_SPAMinwind.it> wrote in message
    news:dukni.60$...
    > Hy guys,
    >
    > I'm sorry for my bad english,
    >
    > I have a problem writing a text file:
    >
    > I have this 2 lines:
    > abcd = 0;zzzzzzzzzzzzzzzzzzzz
    > fghi = 1;
    > and I want delete all next ';' (zzzzzzzzzzzzzzz) but not erase the second
    > line;


    You say you have problem writing a text file. Which mean that you have it
    in memory somehow to be able to write it (even if you read it from another
    file).

    Without knowing the specifics, it sounds as simple as getting rid of
    everything past the ;. It may be as simple as:

    Line = Line.substr(0, Line.find_first_of(';') );

    Hard to know without seeing your code.
     
    Jim Langston, Jul 18, 2007
    #2
    1. Advertising

  3. RicK

    RicK Guest

    Jim Langston il 12:50 PM, mercoledì 18 luglio 2007 ha scritto:


    > Line = Line.substr(0, Line.find_first_of(';') );
    >


    ok, it's work

    thank a lot
    riccardo
     
    RicK, Jul 20, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sjaakie
    Replies:
    4
    Views:
    477
    Sjaakie
    Mar 22, 2005
  2. Kosio

    Floats to chars and chars to floats

    Kosio, Sep 16, 2005, in forum: C Programming
    Replies:
    44
    Views:
    1,326
    Tim Rentsch
    Sep 23, 2005
  3. Hongyu
    Replies:
    9
    Views:
    947
    James Kanze
    Aug 8, 2008
  4. M.Posseth

    receiving ??? chars instead of "special" chars

    M.Posseth, Nov 15, 2004, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    265
    Dan Rogers
    Nov 16, 2004
  5. Joey Martin

    Delete until end of line

    Joey Martin, Apr 19, 2007, in forum: ASP General
    Replies:
    2
    Views:
    125
    Bob Barrows [MVP]
    Apr 19, 2007
Loading...

Share This Page