Re: Reading and writing to a file creates null characters

2012-01-13 Thread Denhua
On Jan 12, 6:21 pm, MRAB wrote: > On 12/01/2012 22:26, Denhua wrote: > > > > > > > > > Hi, > > > I've got a file which I'd like to read, modify and write. > > > # file contents > > a > > b > > c > > d > > >

Reading and writing to a file creates null characters

2012-01-12 Thread Denhua
Hi, I've got a file which I'd like to read, modify and write. # file contents a b c d My script reads the file contents into a list and rotates the list and writes it back to the same file. Problem is that the output contains null characters. I don't know where they are coming from. #!/usr/bin/