If anyone is interested I wrote a tutorial on using [binfile] to
create jpg images using only Pure Data
http://www.hellocatfood.com/2012/09/23/create-jpgs-in-pure-data/

On 22 September 2012 18:02, Antonio Roberts <[email protected]> wrote:
> After some experimenting I solved the problem.
>
> I first add the bytes that I want to add. I then use a second
> [binfile] object and use a loop ( [bang( / [until] ) to send each byte
> to the other [binfile]. This adds bytes instead of overwriting.
>
> On 22 September 2012 11:41, Jamie Bullock <[email protected]> wrote:
>>
>> On 20 Sep 2012, at 17:33, Antonio Roberts <[email protected]> wrote:
>>
>>> I'm attempting to use [binfile] to add additional bytes to a file. If
>>> I first read the file - using [read(  - and then specify the write
>>> position -  [writeat 0 ( - when I add bytes they _overwrite_ the
>>> already existing bytes instead of adding new ones.
>>>
>>> Previously I have used one [binfile] object to read a file output each
>>> byte of it to another [binfile] object. This method has worked great
>>> for small files but when I'm faced with 60mb files it takes far too
>>> long!
>>>
>>> Is there a way to add bytes to the beginning of a file without overwriting?
>>>
>>
>> DId you solve this in the end?
>>
>> [binfile] could be trivially extended to allow an |insert( method, which 
>> inserts bytes without overwriting. However, I suspect this kind of insert 
>> operation is going to be relatively inefficient even if it's done on the C 
>> side.
>>
>> Another option, as I suggested off-list is to use [shell] + "cat", but this 
>> isn't portable.
>>
>> Something else you could explore is using [pdlua] and a bit of Lua script: 
>> http://www.lua.org/pil/21.2.2.html
>>
>> For the sort of work you're doing it wouldn't hurt to incorporate pdlua into 
>> your toolbox anyhow.
>>
>> best,
>>
>> Jamie
>>
>>
>>
>
>
>
> --
> ============================
> [email protected]
> http://www.hellocatfood.com
> ============================



-- 
============================
[email protected]
http://www.hellocatfood.com
============================

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to