|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Can someone me out, I can't figure out what I'm doing wrong to
write to a file in binary mode. What's wrong with my code? <?php $fileName = "something.dat"; $string = "This is a string of text"; $ptr = fopen($fileName, 'wb'); fwrite($ptr, $string); fclose($ptr); ?> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
zach wrote:
> Can someone me out, I can't figure out what I'm doing wrong to > write to a file in binary mode. > > What's wrong with my code? > > <?php > > $fileName = "something.dat"; > $string = "This is a string of text"; > > $ptr = fopen($fileName, 'wb'); > > fwrite($ptr, $string); > fclose($ptr); > > ?> > What kind of error messages do you get? Or what result indicates you aren't writing the data correctly? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Jerry Stuckle wrote:
> zach wrote: >> Can someone me out, I can't figure out what I'm doing wrong to >> write to a file in binary mode. >> >> What's wrong with my code? >> >> <?php >> >> $fileName = "something.dat"; >> $string = "This is a string of text"; >> >> $ptr = fopen($fileName, 'wb'); >> >> fwrite($ptr, $string); >> fclose($ptr); >> >> ?> >> > > What kind of error messages do you get? Or what result indicates you > aren't writing the data correctly? > I got a reply from Rik in another php forum already. I wasn't getting an error but I was mistaken on how a binary file should look. I expected it to look differently than just plain old ascii text and it didn't. Thanks for replying. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
zach wrote:
> Jerry Stuckle wrote: >> zach wrote: >>> Can someone me out, I can't figure out what I'm doing wrong to >>> write to a file in binary mode. >>> >>> What's wrong with my code? >>> >>> <?php >>> >>> $fileName = "something.dat"; >>> $string = "This is a string of text"; >>> >>> $ptr = fopen($fileName, 'wb'); >>> >>> fwrite($ptr, $string); >>> fclose($ptr); >>> >>> ?> >>> >> >> What kind of error messages do you get? Or what result indicates you >> aren't writing the data correctly? >> > I got a reply from Rik in another php forum already. I wasn't getting an > error but I was mistaken on how a binary file should look. I expected it > to look differently than just plain old ascii text and it didn't. Thanks > for replying. > This problem won't occur if you cross-post instead of multi-posting. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Jerry Stuckle wrote:
> zach wrote: >> Jerry Stuckle wrote: >>> zach wrote: >>>> Can someone me out, I can't figure out what I'm doing wrong to >>>> write to a file in binary mode. >>>> >>>> What's wrong with my code? >>>> >>>> <?php >>>> >>>> $fileName = "something.dat"; >>>> $string = "This is a string of text"; >>>> >>>> $ptr = fopen($fileName, 'wb'); >>>> >>>> fwrite($ptr, $string); >>>> fclose($ptr); >>>> >>>> ?> >>>> >>> >>> What kind of error messages do you get? Or what result indicates you >>> aren't writing the data correctly? >>> >> I got a reply from Rik in another php forum already. I wasn't getting >> an error but I was mistaken on how a binary file should look. I >> expected it to look differently than just plain old ascii text and it >> didn't. Thanks for replying. >> > > This problem won't occur if you cross-post instead of multi-posting. > Sorry but I don't know what cross posting is. I'll look it up though. |
|
![]() |
| Outils de la discussion | |
|
|