Re: Writing a character to the beginning of the same file
- From: "SAM" <mshyamrao@xxxxxxxxx>
- Date: 27 Apr 2005 20:54:41 -0700
Scott McPhillips [MVP] wrote:
> SAM wrote:
>
> > Hi,
> >
> > I have program that pre-appends a character to a file. it is not
> > working.
> >
> > Here is the problem.
> >
> > I am not able to write a character to the beginning of the file
without
> > affecting the previous content.
> >
> > Is there any limit on the size of the line in UNIX text files?
> >
> > I am doubtful if there is a line length limit for a text file. If
there
> > is line limit then I can easily copy the content of the first line
into
> > a temporary byte array and add the new character to be added to
another
> > temporary byte array and append the old byte array to this new
> > temporary byte array and write the contents of the new array into
the
> > same file at the beginning.
> >
> >
> > can u please help me.
> >
> > SAM
> >
>
> The issue has nothing to do with size of lines. There is no unused
> space in a text file. Adding a character anywhere within a file
makes
> the file longer. Every byte after the insertion point must be
rewritten
> to its new location in the file.
>
> --
> Scott McPhillips [VC++ MVP]
So what is the solution to write a character to the beginning of the
file and not affect the existing content.
.
- Follow-Ups:
- Re: Writing a character to the beginning of the same file
- From: Randy Howard
- Re: Writing a character to the beginning of the same file
- From: Willem
- Re: Writing a character to the beginning of the same file
- From: jake
- Re: Writing a character to the beginning of the same file
- From: codigo
- Re: Writing a character to the beginning of the same file
- References:
- Writing a character to the beginning of the same file
- From: SAM
- Re: Writing a character to the beginning of the same file
- From: Scott McPhillips [MVP]
- Writing a character to the beginning of the same file
- Prev by Date: Re: programming job market in bay area in US
- Next by Date: Re: Writing a character to the beginning of the same file
- Previous by thread: Re: Writing a character to the beginning of the same file
- Next by thread: Re: Writing a character to the beginning of the same file
- Index(es):
Relevant Pages
|