-
Is there a way to do a binary access write in memory with out opening a file???
This is my code now:
Open File For Binary Access Write As #1
Put #1, , buf
Close #1
My variable buf is a buffer from a pdf file and I want to attach it to an Email without creating an intermediate file... Therefore I do not want to open the file --- however I do want to perform the binary access write.
Any ideas????
-
I'm not sure what you mean. To write to a file, you have to open it, that's the whole idea about opening files, you read and write from them. If it's writeprotected then you're not supposed to write to it.
-
I want to bypass creating an intermediate file and send my output over Email as a custom attachment. I do not want to open a file and do a binary access write -- right now it is the only way I know how to get the file in it's correct format. I'm searching for a way to do a binary write in memory...
What I need to attach needs to be translated somehow.
I get a buffer and then I need to send that however it needs to be translated somehow and the binary access write is the only way I know how to do that at this point.
Here are small bits the contents of the buf:
?????????????????????????????????????????H??????????‰????????‰??????????????????????????4??????? ???4??????????????????????????‹‰???????????A?? ????y <?î????À ´?¯?
?»???ã??Û??????????????????????????????????????????????????????????????????Â???a?´d?? ?a ???Aa?a ?^C?A??´ A^????????????~???a A^?????????????? ????????????AAa ?Ð?????´~~a ??????????????a??Aj ??
And this is after the binary write:
&h %PDF-1.3
%äãÏÒ
5 0 obj
<</Length 6 0 R
/Filter/FlateDecode
>>
stream
xœ+ä2Tðâ,. &æendstream
þä}È
Og!û6lµR†p†€ú]ˆ{;5„‡Ÿ,•Œ]€ˆúnü“i®˜‚SÙ–Â@<'ü>É,cE²Ë$bXRRZ)ÑìPã Ùdlãl0)
-
:confused:
I mean how did you translate those "?"'s into that? Binary writes down the memory of variables without descriptors or anything, but i can't anything of what you showed. What methods did you use to get the file? Did you input/get it into a textbox or what?
-
The buffer (all those ?????'s) came from a pdf component and then I was doing a binary write to get the change in code. I wanted to avoid writing to a file.
What I am doing now is using the stream object which is new to the ADO 2.5 release.
By setting the Charset = "Windows-1252" it will then convert the files.