473,394 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

binary-safe fget?

I understand that fget is not binary-safe before php version 4.3.3.
To me that means fget cannot read binary data (or clips it to 7 bits).
Is there another php function equiv. to fget that is binary safe. I
am not quite ready to upgrade to 4.3.3.

Thanks.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-binary-s...ict138381.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=462446
Jul 17 '05 #1
4 2664
steve wrote:
I understand that fget is not binary-safe before php version 4.3.3.
To me that means fget cannot read binary data (or clips it to 7 bits).
Is there another php function equiv. to fget that is binary safe. I
am not quite ready to upgrade to 4.3.3.


There is no function fget. fgets is not binary safe until version 4.3 (not
4.3.3). fgetc is binary safe. fread, which is referenced from fgets
documentation page on php.net, is binary safe. Also read the fopen docs if
you are on Windows.
Jul 17 '05 #2
On 10 Aug 2004 15:08:07 -0400, steve <Us************@dbForumz.com> wrote:
I understand that fget is not binary-safe before php version 4.3.3.
To me that means fget cannot read binary data (or clips it to 7 bits).
Is there another php function equiv. to fget that is binary safe. I
am not quite ready to upgrade to 4.3.3.


PHP doesn't have an fget function, do you want fgets (read line from file
pointer)?

If so you could make this from fread (read in chunks, scan for newline, return
line and save the rest or rewind the file pointer) or fgetc (read character by
character until newline, bound to be slower though).

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
(v1.4.0 new 1st Aug 2004)
Jul 17 '05 #3
steve wrote:
I understand that fget is not binary-safe before php version 4.3.3.
To me that means fget cannot read binary data (or clips it to 7 bits).
Is there another php function equiv. to fget that is binary safe. I
am not quite ready to upgrade to 4.3.3.


http://www.php.net/manual/en/function.fgetc.php
JW

Jul 17 '05 #4
"Andy Hassall" wrote:
On 10 Aug 2004 15:08:07 -0400, steve
<Us************@dbForumz.com> wrote:
I understand that fget is not binary-safe before php version

4.3.3.
To me that means fget cannot read binary data (or clips it to 7

bits).
Is there another php function equiv. to fget that is binary safe.

I
am not quite ready to upgrade to 4.3.3.


PHP doesn’t have an fget function, do you want fgets (read line
from file
pointer)?

If so you could make this from fread (read in chunks, scan for
newline, return
line and save the rest or rewind the file pointer) or fgetc (read
character by
character until newline, bound to be slower though).


Thanks, Andy. I did mean fgets. Ok, you are right. I can use
fread.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-binary-s...ict138381.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=462527
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: yaipa | last post by:
What would be the common sense way of finding a binary pattern in a ..bin file, say some 200 bytes, and replacing it with an updated pattern of the same length at the same offset? Also, the...
20
by: Christian Stigen Larsen | last post by:
A signed int reserves one bit to signify whether a number is positive or negative. In light of this, a colleague asked me whether there existed an int in C++ that was -0, a zero with the negative...
3
by: Tron Thomas | last post by:
What does binary mode for an ofstream object do anyway? Despite which mode the stream uses, operator << writes numeric value as their ASCII representation. I read on the Internet that it is...
103
by: Steven T. Hatton | last post by:
§27.4.2.1.4 Type ios_base::openmode Says this about the std::ios::binary openmode flag: *binary*: perform input and output in binary mode (as opposed to text mode) And that is basically _all_ it...
9
by: Ching-Lung | last post by:
Hi all, I try to create a tool to check the delta (diff) of 2 binaries and create the delta binary. I use binary formatter (serialization) to create the delta binary. It works fine but the...
7
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should...
68
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
5
by: bwv539 | last post by:
I have to output data into a binary file, that will contain data coming from a four channel measurement instrument. Since those data have to be read from another C program somewhere else, the...
10
by: rory | last post by:
I can't seem to append a string to the end of a binary file. I'm using the following code: fstream outFile("test.exe", ios::in | ios::out | ios::binary | ios::ate | ios::app)...
16
by: Erwin Moller | last post by:
Why is a binary file executable? Is any binary file executable? Is only binary file executable? Are all executable files binary? What is the connection between the attribute of binary and that of...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.