Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!feeder1-1.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-Id: <2972164.SPkdTlGXAF@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 23 Jun 2011 09:55:45 +0200 User-Agent: KNode/4.4.7 Content-Transfer-Encoding: 8Bit Subject: Re: Command line cannot fwrite, browser can Newsgroups: comp.lang.php References: <8844491.SEqChMirdb@PointedEars.de> <8855064.SEqChMirdb@PointedEars.de> Followup-To: comp.lang.php MIME-Version: 1.0 Lines: 132 NNTP-Posting-Date: 23 Jun 2011 09:55:46 CEST NNTP-Posting-Host: edbef1df.newsspool1.arcor-online.net X-Trace: DXC=Mc\EOM2DYfU\9P[:DUn00Qic==]BZ:af^4Fo<]lROoRQ<`=YMgDjhgRE4CgK@@nP?\DZm8W4\YJN\T<8F<]0D<`Y0@<8?IEo`lUjV]`ah8QGo^ X-Complaints-To: usenet-abuse@arcor.de Xref: x330-a1.tempe.blueboxinc.net comp.lang.php:2307 Adrienne Boswell wrote: > Thomas 'PointedEars' Lahn wrote: >> Adrienne Boswell wrote: >>> Jerry Stuckle writing: >>>> Adrienne Boswell wrote: >>>>> Thomas 'PointedEars' Lahn writing: >>>>>>> $groupmail = fopen( $filename,'w' ) or die( 'cannot open >>>>>>> groupmail.html' ); >>>>>> >>>>> Thank you for all your help, and the link. I have read it and will >>>>> implement it. >>>> I think you have another problem. Single vs. double quotes would >>>> not make any difference in the code you posted. >>> […] >>> Yes, this is nagging me, too. I just checked it ran it right now (I >>> also moved the script so it is not accessible to the WWW), >> >> This is not the World Wide Web, an application of the Internet, but >> Usenet, a part of the Network News network (a growing part of which is >> part of the Internet). So you may – SHOULD – as well post the >> *relevant* *parts* of your working code here. > > Ok, here is the relavent piece of code (the relavent parts were snipped by > Jerry). ACK, thanks. > Originally (with line numbers and I have replaced the real domain with > example.com): > > 68 $filename = "C:\Inetpub\vhosts\example.com\httpdocs\groupmail > \groupmail.html"; > > 80 $groupmail = fopen( $filename,'w' ) or die( 'cannot open > groupmail.html' ); > > > Warning: > fopen(C:\Inetpub?hosts\example.com\httpdocs\groupmail\groupmail.ht ml): > failed to open stream: Invalid argument in C:\Inetpub\vhosts > \example.com\httpdocs\groupmail.php on line 80 cannot open groupmail.html > > > So when I changed line 68 to: > > 68 $filename = 'C:\Inetpub\vhosts\example.com\httpdocs\groupmail > \groupmail.html'; I can see the problem now. You have used the sequence "\v" in your string literal. That makes the difference, because in double-quoted strings it is parsed as a (vertical tab) character (that originates from early TTYs and is hardly used nowadays, but kept for backwards compatibility [1]). Hence the question mark in the warning after the "b" of "Inetpub", and the missing "v" after it. is not one of the printable characters, so a replacement character is used to display it. In a single-quoted string, that and most other escape sequences carry no special meaning [2]. So the path fits, and the file can be opened, then. Since you cannot know beforehand which escape sequences are considered by a certain version of PHP (other than `\\'), you should always escape literal backslashes in string literals: "\\" or '\\' [2]. In fact, you MUST escape them when at the end of the string value, because otherwise \" or \' constitute escape sequences of themself, and the string value is not terminated: $ php -a Interactive mode enabled (end of text), an ASCII character (code point 0x03) that signals to the process that the standard input stream is finished. It can also be used to `logout' quickly from a unixoid shell.] But for file paths you can replace the backslashes with forward slashes (`/') even in WinDOS, which do not need to be escaped [3]. >> That puts into serious doubt whether you are worth getting further, >> rather time-consuming, answers like the ones I give to you. Think >> about that. > > One of the reasons I came here was because I have high respect for your > knowledge. Thank you. > You might think that because I'm girl I have thin skin, but I don't. All people are the same before PointedEars ;-) > I have been around Usenet since 1996, so I have seen a lot, > including your latest run-in with Jukka Korpela. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ What is that supposed to mean? (You may reply to this by PM.) Please trim your quotes to the relevant minimum [4]. PointedEars ___________ [1] [2] [3] [4] -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, (2004)