Removing line breaks from the file
Posted on 2004-07-30
I have a txt file which is generated in Mac with CRLF line breaks. Now, i am trying to read each line of this file in PC environment (Linux). But i couldn't do it yet, getting mad!
Could you please tell me how can i read from a file until the end of line... I am using the below code to read from the file but it reads all lines :(
$FileHandle = fopen("./mac.txt", "r");
// Read only first line
$FirstLine = trim(fgets($FileHandle, 4096));
$FirstLine should include only the first line, but it includes all lines. How can i read a line from the file until the end of line (no matter CRLF, LF or CR)