/    Sign up×
Community /Pin to ProfileBookmark

Binary File Read

Is there a way to read a file in Binary mode, and to save a file in binary mode?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsDec 26.2005 — Most of the PHP functions are binary file safe.
Copy linkTweet thisAlerts:
@Kyleva2204authorDec 26.2005 — Most of the PHP functions are binary file safe.[/QUOTE]
and that means? LOL... Im meaing is there a function that u can open a file, and out put the information in the file (the data) in binary. and then resave the file.. In binary, but it will be a valid file, ya know?
Copy linkTweet thisAlerts:
@bokehDec 26.2005 — Read a binary file into a string: [code=php]$binary_data = file_get_contents($filename);[/code]Write binary data to file (PHP4):[code=php]$pointer = fopen($filename, 'w+');
fwrite($pointer, $binary_data, strlen($binary_data);
fclose($pointer);[/code]
Write binary data to file (PHP5):[code=php]file_put_contents($filename, $binary_data);[/code]
Copy linkTweet thisAlerts:
@Kyleva2204authorDec 26.2005 — aalrightty, I htink i gots what I needs now ^_^ thanks all
×

Success!

Help @Kyleva2204 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...