FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fopen error
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: fopen error [message #175233 is a reply to message #175230] Sun, 28 August 2011 16:07 Go to previous messageGo to previous message
eBob.com is currently offline  eBob.com
Messages: 11
Registered: August 2011
Karma:
Junior Member
Thanks A. I was able to find my dumb typo/logic error this morning. Thanks
for making me aware of the file_get_contents and file_put_contents
functions. I like to make my code as concise as possible.

Incidentally ... I am using single backslashes on the (Windows) command line
to specify file names and somehow that seems to be working fine. I'm using
PHP 5.3.

Thanks again,

Bob

"A" <a(at)a(dot)a> wrote in message news:j3dml8$3kh$1(at)gregory(dot)bnet(dot)hr...
>> $fpFileOut = fopen($fileout,"c");
>> if (!$fpFileOut) {echo "Error opening $fileout\n"; echo E-WARNING;
>> exit;}
>
> do an echo $fileout; before fopen to see what the folder/file is.
>
> remember the following:
>
> - in linux/unix the filenames are case sensitive and file system is a bit
> different than windows
> - when you define $fileout remember if you use backslashes you need to
> escape them so it is not
> $fileout = "c:\folder\file.txt";
> rather
> $fileout = "c:\\folder\\file.txt";
>
> in php you can use forward slashes instead which don't require escaping:
>
> $fileout = "c:/folder/file.txt";
>
> - you need to have write permissions (755, 666 etc.) if it is unix/linux
> system. many hosters set this for PHP but you haven't specified what kind
> of host you test this on.
>
> it is probably my lazyness, but unless you really need fopen you can get
> by just fine with much easier functions like readfile, file(),
> file_get_contents(), file_put_contents()... all work done in a single line
> rather than fopen, fread, fwrite, fclose.
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mktime 2-digit vs 4-digit year
Next Topic: OpenSSL, openssl_pkey_get_private
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Oct 19 23:17:01 GMT 2024

Total time taken to generate the page: 0.04234 seconds