|
Posted by Sheldon Glickler on 10/19/20 11:40
I have what I thought was a simple task. I have a file with an orderd list
in it that I use in a readfile to generate an html page. When I want to
insert a new entry into that list, it should be in the proper place. My
procedure is to create an array using file('filename'). I then search in
that list for the proper placement, writing each line to a target file with
an fwrite command. I write the new line and then I write the rest of the
array. Simple, yes?
Well, all the lines that I generated with the file command write back
perfectly. I cannot seem to get the new entry to generate a line
feed-carriage return. This is on a Windows system. I have tried "\n" and
have "\r\n" and even nothing at all. No success. I have temporarily done a
work-around by having the first line of the original file be blank and
appending $lines[0] to the new entry where $lines is the array I generated.
Any ideas? I would like to solve this the correct way.
Note: I added the formatting as follows
fwrite($handle, "The new entry information\r\n");
Shelly
Navigation:
[Reply to this message]
|