php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24059 fputs($datei,"\n"); don't go in a new line
Submitted: 2003-06-06 08:40 UTC Modified: 2003-06-07 04:46 UTC
From: michael dot hofinger at utanet dot at Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.2 OS: Windows XP SP1 German
Private report: No CVE-ID: None
 [2003-06-06 08:40 UTC] michael dot hofinger at utanet dot at
example:
<?php
	$dateiname = "clients.txt";
	
	$datei=fopen($dateiname,"a");
	fputs($datei,"hello");
	fputs($datei,"\t"); // tab OK!
	fputs($datei,"test");
	fputs($datei,"\n"); // new line NOT OK!
	fputs($datei,"hello");
	
	fclose($datei);
?>

the script work with PHP 4.3.0 without problems!
(i use the php.ini from php 4.3.0 although in 4.3.2)

Apache 1.3.27
php as module

mfg
Mike

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-06 09:57 UTC] wez@php.net
Starting with PHP 4.3.2, the default mode for all fopen()d files is binary mode to match CLI and CGI versions of PHP, and also the default behaviour of PHP on other platforms.

You can use the 't' mode to explicitly open files in text mode like this:

$datei = fopen($dateiname, 'at');
 
 [2003-06-07 04:42 UTC] michael dot hofinger at utanet dot at
It works. :-)

Thank you for your help!!
 [2003-06-07 04:46 UTC] sniper@php.net
Not bug -> bogus.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 15:01:31 2024 UTC