Uploading text files with serial extender
Keywords: pPutBinary
Question:
I love your new serial extender for Winbatch, but I don't understand why you haven't made it easier to squirt a plain text file out the serial port without using an error-correcting protocol (It would be nice, though not essential, if I could construct a progress indicator, too). I work for a newspaper where our reporters send dozens of text files into our main frame every day from their laptops. I'd love to write a stand-alone application in Winbatch to automate the process, but I just can't find a way. Can you help?Answer:
Well...mostly it's not done beause it does not work. But for a pure squirt, ignoring line noise and a host of errorprone overrun conditions....That will just dump the file out the serial port. I recommend some kind of error correction protocol on both sizes. Either XMODEM or ZMODEM or something. (Which does have a progress indicator) or at least checksum the binary buffer before sending it.
- Establish a comlink and get a port handle.
- Squirt a file.
fn="C:\filname.of.file.to.squirt" fs=Filesize(fn) binbuf=BinaryAlloc(fs) BinaryRead(binbuf,fn) binaddr=IntControl(42,binbuf,0,0,0) pPutBinary(port,binaddr,fs) BinaryFree(binbuf)
Article ID: W12580Filename: Uploading Text Files using Serial Extender.txt