On Wednesday, January 25, 2023 at 11:10:31 AM UTC-5, ed de moel wrote:
I'm building a jpg (image) file from a web-upload.
I'll try your suggestion.
Thanks,
Ed
Ed,
Unfortunately, reading and writing a binary file is pretty difficult.
I have code that is working and is in production:
https://gitlab.com/YottaDB/Util/YDB-Web-Server/-/blob/master/src/_ydbwebapi.m#L118
Read is:
1. Open with "FIXED": O PATH:(REWIND:READONLY:FIXED:CHSET="M")
2. Read length-limited reads: N X F R X#4079:0 S HTTPRSP(C)=X,C=C+1 Q:$ZEOF 3. Close file.
https://gitlab.com/YottaDB/Util/YDB-Web-Server/-/blob/master/src/_ydbwebrsp.m#L239
Write is:
1. Open with STREAM, NOWRAP and CHSET of M: o file:(newversion:stream:nowrap:chset="M")
2. Write Data
3. Set $X to zero
4. Close file.
Keep in mind that if you are operating in UTF-8 mode (the default), you always need to use the byte operators $ZCHAR, $ZASCII, and $ZLENGTH and $ZPIECE.
--Sam
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)