Questions tagged [splfileobject]

SplFileObject is a PHP class which offers an object oriented interface for a file.

SplFileObject is part of the Standard PHP Library (SPL). It offers an object oriented interface for a file. Documentation can be found here. It is available by default from PHP 5.1.0 onwards.

48 questions
0
votes
1 answer

$file->eof() always returning false when using PHP's SplFileObject

Why is my PHP script hanging? $path = tempnam(sys_get_temp_dir(), '').'.txt'; $fileInfo = new \SplFileInfo($path); $fileObject = $fileInfo->openFile('a'); $fileObject->fwrite("test line\n"); var_dump(file_exists($path)); //…
mattalxndr
  • 9,143
  • 8
  • 56
  • 87
0
votes
1 answer

C++/VC++ alternatives for PHP's SplFileObject class

Is there any hand coded class or VC++ plugin available that is same as PHP's SplFileObject? Please see the question https://stackoverflow.com/questions/10650864/fetching-nth-line-of-a-file/10650864#10650864. I want to achieve this using C++
Tabrez Ahmed
  • 2,830
  • 6
  • 31
  • 48
0
votes
1 answer

Why PHP file handler doesn't work properly?

I have this content on 'test.txt' file: lucas I want to seek pointer in the file and override info ahead. Supposed I do: $f = new SplFileObject('test.txt', 'a'); $f->fseek(-5, SEEK_END); var_dump($f->ftell()); $f->fwrite('one'); This should…
Lucas Batistussi
  • 2,283
  • 3
  • 27
  • 35
1 2 3
4