• DOS 5 QBASIC (in XPsp3) write to win32 named pipe ?

    From R.Wieser@21:1/5 to All on Thu Mar 7 12:30:47 2024
    Hello all,

    I'm using QBasic from DOS 5 in an XPsp3 cmd.exe console, and am trying to
    write to a file which is actually a named pipe in a Win32 program.

    The thing is that it works when, in QBASIC, I open the file "for binary" and "put" the data. However, when I open the file "for output" than I can see,
    in the Win32 program, the data coming in from the pipe, but the QBASIC
    program than throws an "invalid record number" on the "close #hPipe" line - after which I cannot re-run, save or exit the program (all of which again
    show the "invalid record number" error).

    tl;dr:
    Has anyone ever tried to let QBASIC open a named pipe and wtite to it as if
    its a regular text file ? If so, how/as what should I, in the Win32
    program, open the named pipe ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Thu Mar 7 14:40:33 2024
    Has anyone ever tried to let QBASIC open a named pipe and wtite to it as
    if its a regular text file ? If so, how/as what should I, in the Win32 program, open the named pipe ?

    To text/check I just wrote a small DOS program using INT 21h calls to open (AX=3D01h), write to(AH=40h) and close (AH=3Eh) the pipe. As far as I can
    tell that works without a problem.

    IOW, the problem might be QBASIC ...

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Auric__@21:1/5 to R.Wieser on Thu Mar 7 17:16:11 2024
    On 07 Mar 2024, R.Wieser wrote:

    Has anyone ever tried to let QBASIC open a named pipe and wtite to it as
    if its a regular text file ? If so, how/as what should I, in the Win32
    program, open the named pipe ?

    To text/check I just wrote a small DOS program using INT 21h calls to open (AX=3D01h), write to(AH=40h) and close (AH=3Eh) the pipe. As far as I can tell that works without a problem.

    IOW, the problem might be QBASIC ...

    Probably. I've never tried doing anything remotely like what you're trying to do, but QBasic is somewhat limited in what it can and cannot do (although I don't think it's a QBasic-vs-QuickBASIC thing) but also, it predates 32-bit Windows by several years. Does your program *need* to be in QBasic? You could try it in FreeBASIC using '-lang fblite' or even '-lang qb' and see what happens. (You could probably also try QB64 but I can't help you there.)

    --
    If you're aware you exist, then you do.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Thu Mar 7 19:30:00 2024
    Auric,

    Does your program *need* to be in QBasic?

    Its not about a program, but about extending QBasic's capabilities - so it
    can easily communicate with a Win32 program. How I'm going to use that is
    step two (although I already have an idea or two)

    but QBasic is somewhat limited in what it can and cannot do

    I know. But it can write to a file. It just happens not to like the
    pipe-file I'm offering it.

    ... Which I took as me having created the pipe in a wrong mode (hence the question), but I'm now doubting that as I have zero problems when doing the same writing with a standard 16-bit DOS executable.

    And mind you, I'm a hobbyist. As nobody is paying me for my time I'm allowed
    to squander it on figuring stuff like this out. :-)

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to R.Wieser on Fri Mar 8 12:23:15 2024
    On Thu, 7 Mar 2024 12:30:47 +0100, R.Wieser wrote:
    Hello all,

    I'm using QBasic from DOS 5 in an XPsp3 cmd.exe console, and am trying to write to a file which is actually a named pipe in a Win32 program.

    The thing is that it works when, in QBASIC, I open the file "for binary" and "put" the data. However, when I open the file "for output" than I can see, in the Win32 program, the data coming in from the pipe, but the QBASIC program than throws an "invalid record number" on the "close #hPipe" line - after which I cannot re-run, save or exit the program (all of which again show the "invalid record number" error).

    tl;dr:
    Has anyone ever tried to let QBASIC open a named pipe and wtite to it as if its a regular text file ? If so, how/as what should I, in the Win32
    program, open the named pipe ?

    Regards,
    Rudy Wieser

    Pipe (named or not) is a character device. It has no total data size, and is not seekable. IOTW, data size query and seek operations are not applicable
    to character device.

    Q/BASIC's binary file mode is a random-access file mode which treats file as
    a block device, instead of a character device. But random-access file mode
    does I/O seek as well as querying the total data size.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Fri Mar 8 11:18:53 2024
    JJ,

    I do not know what your game is, but I disagree with most anything you said there.

    It also doesn't help that you're rather ambigue and seem to be making a
    claim that opening a file using a certain open mode can turn it from a character device into a block device.

    Its almost as if you're out to sow confusion ...

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From JJ@21:1/5 to R.Wieser on Sat Mar 9 14:59:58 2024
    On Fri, 8 Mar 2024 11:18:53 +0100, R.Wieser wrote:
    JJ,

    I do not know what your game is, but I disagree with most anything you said there.

    It also doesn't help that you're rather ambigue and seem to be making a
    claim that opening a file using a certain open mode can turn it from a character device into a block device.

    Its almost as if you're out to sow confusion ...

    Regards,
    Rudy Wieser

    Then I don't think you know the difference between the two.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Mar 9 09:56:35 2024
    JJ,

    Then I don't think you know the difference between the two.

    Than now is your chance to educate me to what (you think) a "character
    device" and "block device" are.

    There is a possibility that you and I are not thinking about the same thing. Maybe, after having heard your definitions of them I would be able to understand what you wrote.

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Sat Mar 9 10:14:31 2024
    The thing is that it works when, in QBASIC, I open the file "for binary"
    and "put" the data.

    After more testing it looks like that even the above "for binary" method is
    not fully stable : while I can run a QBasic program using the above method, re-running it (SHIFT F5) works when talking to one Win32 (GUI) program, but
    the second file-opening fails when talking to another Win32 (console)
    program.

    As a 16-bit DOS program didn't seem to suffer from the same I loaded the INT 21h open, write and close functions as binary blobs into the QBasic program
    and used them with "CALL absolute()". It now seems to function quite well, regardles of the used Win32 "server" program (though the stress-test still needs to be done).

    Question :

    Although accessing arguments in the binary blob that where provided to the "CALL absolute()" function works, I've never been able to check the
    arguments type (integer, string, etc). Does anyone remember/know how to do that ?

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From R.Wieser@21:1/5 to All on Tue Mar 12 10:14:21 2024
    JJ,

    Then I don't think you know the difference between the two.

    Than now is your chance to educate me to what (you think) a "character device" and "block device" are.

    Too bad that you didn't respond. You might have had some knowledge I am not (yet) aware of (and possibly relevant to the question I asked). Now I will never know ...

    JJ, what happened to you ? You're so much different from the one I knew
    from even just a year ago that you seem to be a different person. :-|

    Regards,
    Rudy Wieser

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)