|
|
|||||||
New feature request: Binmode Reading and Writing. |
||||||||
|
|
|||||||
me want too. |
||||||||
|
|
|||||||
me want three |
||||||||
|
|
|||||||
I will take binmode reading and writing for Number 4. |
||||||||
|
|
|||||||
I'll take BINMODE READING for 400 and got a joker |
||||||||
|
|
|||||||
I'll take Current Events for 1000, Alex. And the answer is: BIN READING What has Osama bin doing for the past 12 months, squirreled away in his mountain retreat. lol |
||||||||
|
|
|||||||
I liked that one. ROTFLMAO |
||||||||
|
|
|||||||
ROFL. Good one Shawn! |
||||||||
|
|
|||||||
Bin Running Bin Hiding Bin Ducking Bin Dodging |
||||||||
|
|
|||||||
Bin Writing Bin Sending Bin Downgrading Bin Daytrading |
||||||||
|
|
|||||||
let's please try and remain professional in the Suggestions forum. We do of course, want Ruud to take us seriously. |
||||||||
|
|
|||||||
If we don't give him bbChecker, he'll have to start at the beginning of the thread while it was still serious...Maybe the point will be made by the time he makes it half way down. [ 18. November 2002, 21:04: Message edited by: Howard Bullock ] |
||||||||
|
|
|||||||
How do you guys see the binary I/O working? Personally I'd like to see an extension to KiXtart which includes binary data types which would be used for other things like information returned by COM objects and the like. Another (far simpler) approach would be to provide some new file functions that use a buffer. The buffer is an array in which each element is the ASCII value of the character which has been read/will be written. The functions would take the form: code:$iBytesRead is the number of bytes successfully read, "0" if there is no more data (end of file) and "-1" if there is an error.$iBytesRead=ReadArray($fdFileDescriptor,$aiDataRead,$iBytesToRead) $fdFileDescriptor is the file number used in the file Open(). $aiDataRead is the array which will contain the values of the data read. $iBytesToRead is the number of bytes that you want to read - could be optional in which case it is the size of the array. Similarly the write would be: code:The wide awake among you will have spotted a problem with ReadArray(). The array is passed as a parameter. To be able to populate the array with the data, we would need pass-by-reference support in KiXtart, and we don't. Yet.$iBytesWritten=WriteArray($fdFileDescriptor,$aiWriteData,$iBytesToWrite So, ReadArray can be simplified to: code:@ERROR can be checked for end-of-file and error conditions. The number of bytes read is the size of the array.$aiDataRead=ReadArray($fdFileDescriptor,$iBytesToRead) I prefer the first method as there is a small problem with this way of doing reads in that it is tricky to identify when some data was read before an error occurred. The other change required is that the Open() function will probably need a flag to ensure that the file is opened in binary or "raw" mode. This is because it will probably be required by the underlying file open API. Mixing binary and non-binary reads and writes may be possible, but the results will be hard to predict and should be avoided. Performing binary reads and writes on a file not opened in binary mode (and vice versa) will also have unexpected results. Some more thoughts (shouldn't think and type at the same time ) If binary file I/O is implemented it should be able to support random file I/O, i.e.:
Other useful support functions would allow filling an array with a character, padding a string to a length with an arbitrary character and split()/join() to work with a null delimiter. The more I think about it the more complex it gets. Enough of my ramblings, for now. |
||||||||
|
|
|||||||
Some good thoughts and ideas Richard, but sort of sounding more like a Binary Editor rather then a script processor. Personally have had very little need to modify too many binary files with a script, but I do see where the use of supporting NULLS has come up for me and any many posts on the board. Supporting binary mode would include this, so thus I agree we need some sort of support. Hopefully Ruud reads all these suggestion posts and can give some feedback as well some time. |
||||||||
|
|
|||||||
script processor? script processor processes scripts given to it. doesn't matter does the script processor support binary editing or not, it still is script processor as long as it does process the scripts. see? |
||||||||
|
|
|||||||
This isn't English 101 don't get so caught up in names Jooel. |
||||||||
|
|
|||||||
I've recently posted a solution for reading and writing binary data using KiXtart elsewhere on the board - including NULLs. |
||||||||
|
|
|||||||
Hi Richard, do you have a link to that post? |
||||||||
|
|
|||||||
doc, sure this isn't. but you need to understand my point. what you think script processor (or kixtart) should be like, may not fit to anybody elses ideas. or... anyway, I think you get my point. |
||||||||
|
|
|||||||
Quote: Here you go. The routines in the link convert to/from "byte array" format which you can use directly with ADODB.stream to read and write binary files. |