Tayfur Well-Known Member Licensed User Longtime User Feb 13, 2016 #1 <?php $f = fopen('abc.dat",'wb'); fwrite($f,$buffer,strlen($buffer)); fclose($f); Iwant to translte this code php to B4a; What is your best way. file.writetext is not works. result file is not good.
<?php $f = fopen('abc.dat",'wb'); fwrite($f,$buffer,strlen($buffer)); fclose($f); Iwant to translte this code php to B4a; What is your best way. file.writetext is not works. result file is not good.
DonManfred Expert Licensed User Longtime User Feb 13, 2016 #2 Tayfur said: file.writetext is not works Click to expand... it works! What let you think it will not work? Maybe your requirements does not fit the possibilities of writetext if your buffer is for example a bytearray then you could do it like this B4X: Dim out As OutputStream out = File.OpenOutput(File.DirDefaultExternal,"abc.dat",False) out.WriteBytes(buffer,0,buffer.length) out.Flush out.Close But reading the documentation could help to find it yourself! Upvote 0
Tayfur said: file.writetext is not works Click to expand... it works! What let you think it will not work? Maybe your requirements does not fit the possibilities of writetext if your buffer is for example a bytearray then you could do it like this B4X: Dim out As OutputStream out = File.OpenOutput(File.DirDefaultExternal,"abc.dat",False) out.WriteBytes(buffer,0,buffer.length) out.Flush out.Close But reading the documentation could help to find it yourself!
Tayfur Well-Known Member Licensed User Longtime User Feb 13, 2016 #3 DonManfred said: it works! What let you think it will not work? Maybe your requirements does not fit the possibilities of writetext if your buffer is for example a bytearray then you could do it like this B4X: Dim out As OutputStream out = File.OpenOutput(File.DirDefaultExternal,"abc.dat",False) out.WriteBytes(buffer,0,buffer.length) out.Flush out.Close But reading the documentation could help to find it yourself! Click to expand... thanks for helps Upvote 0
DonManfred said: it works! What let you think it will not work? Maybe your requirements does not fit the possibilities of writetext if your buffer is for example a bytearray then you could do it like this B4X: Dim out As OutputStream out = File.OpenOutput(File.DirDefaultExternal,"abc.dat",False) out.WriteBytes(buffer,0,buffer.length) out.Flush out.Close But reading the documentation could help to find it yourself! Click to expand... thanks for helps