How to read a text file line by line and remove some line

Discussion in 'C++' started by kaushikshome, Sep 10, 2006.

  1. kaushikshome

    kaushikshome Guest

    Can anyone please help me in writing the code in C++ :

    I want a read a file line by line,remove the lines which have length of
    a particular field in a line exceeding 63 characters After removing the
    line the corresponding blank spaces generated after removal of the
    line also needs to be removed.
    ..
    I am in urgent need for this solution.Kindly help how to go about it.

    Thanks in advance ,

    Kaushik
    kaushikshome, Sep 10, 2006
    #1
    1. Advertising

  2. kaushikshome

    osmium Guest

    "kaushikshome" writes:

    > Can anyone please help me in writing the code in C++ :
    >
    > I want a read a file line by line,remove the lines which have length of
    > a particular field in a line exceeding 63 characters After removing the
    > line the corresponding blank spaces generated after removal of the
    > line also needs to be removed.
    > .
    > I am in urgent need for this solution.Kindly help how to go about it.


    Where is your problem at? Can you open a file? read a line? write a line?

    What is it you can't do?
    osmium, Sep 10, 2006
    #2
    1. Advertising

  3. kaushikshome

    Jerry Coffin Guest

    In article <>,
    says...
    > Can anyone please help me in writing the code in C++ :
    >
    > I want a read a file line by line,remove the lines which have length of
    > a particular field in a line exceeding 63 characters After removing the
    > line the corresponding blank spaces generated after removal of the
    > line also needs to be removed.
    > .
    > I am in urgent need for this solution.Kindly help how to go about it.


    You can't delete data from the middle of the file, so you have to copy
    data from the existing file to a new file, skipping over the parts you
    don't want.

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
    Jerry Coffin, Sep 10, 2006
    #3
  4. kaushikshome

    kaushikshome Guest

    Boss I am new at C++ programming.....how can I open , read and write it
    to a new file after ignoring certain lines..kindly tell me how to go
    about it...(code)

    Regards,

    Kaushik
    osmium wrote:

    > "kaushikshome" writes:
    >
    > > Can anyone please help me in writing the code in C++ :
    > >
    > > I want a read a file line by line,remove the lines which have length of
    > > a particular field in a line exceeding 63 characters After removing the
    > > line the corresponding blank spaces generated after removal of the
    > > line also needs to be removed.
    > > .
    > > I am in urgent need for this solution.Kindly help how to go about it.

    >
    > Where is your problem at? Can you open a file? read a line? write a line?
    >
    > What is it you can't do?
    kaushikshome, Sep 10, 2006
    #4
  5. kaushikshome

    kaushikshome Guest

    Ok...let me analyse it and I shall get back to u soon..
    thanks for replying..
    regards,

    Kaushik
    Jerry Coffin wrote:

    > In article <>,
    > says...
    > > Can anyone please help me in writing the code in C++ :
    > >
    > > I want a read a file line by line,remove the lines which have length of
    > > a particular field in a line exceeding 63 characters After removing the
    > > line the corresponding blank spaces generated after removal of the
    > > line also needs to be removed.
    > > .
    > > I am in urgent need for this solution.Kindly help how to go about it.

    >
    > You can't delete data from the middle of the file, so you have to copy
    > data from the existing file to a new file, skipping over the parts you
    > don't want.
    >
    > --
    > Later,
    > Jerry.
    >
    > The universe is a figment of its own imagination.
    kaushikshome, Sep 10, 2006
    #5
    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. Krish
    Replies:
    1
    Views:
    1,077
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Oct 20, 2005
  2. Hugo
    Replies:
    10
    Views:
    1,303
    Matt Humphrey
    Oct 18, 2004
  3. Thomas Kowalski
    Replies:
    6
    Views:
    794
    Branimir Maksimovic
    May 18, 2007
  4. scad
    Replies:
    23
    Views:
    1,161
    Alf P. Steinbach
    May 17, 2009
  5. Alex Dowad
    Replies:
    4
    Views:
    268
    Michel Demazure
    May 1, 2010
Loading...

Share This Page