Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #4403 > unrolled thread

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

Started by"R.Wieser" <address@is.invalid>
First post2024-03-07 12:30 +0100
Last post2024-03-09 10:14 +0100
Articles 10 — 3 participants

Back to article view | Back to comp.os.msdos.programmer


Contents

  DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-07 12:30 +0100
    Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-07 14:40 +0100
      Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "Auric__" <not.my.real@email.address> - 2024-03-07 17:16 +0000
        Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-07 19:30 +0100
    Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? JJ <jj4public@outlook.com> - 2024-03-08 12:23 +0700
      Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-08 11:18 +0100
        Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? JJ <jj4public@outlook.com> - 2024-03-09 14:59 +0700
          Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-09 09:56 +0100
            Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-12 10:14 +0100
    Re: DOS 5 QBASIC (in XPsp3) write to win32 named pipe ? "R.Wieser" <address@is.invalid> - 2024-03-09 10:14 +0100

#4403 — DOS 5 QBASIC (in XPsp3) write to win32 named pipe ?

From"R.Wieser" <address@is.invalid>
Date2024-03-07 12:30 +0100
SubjectDOS 5 QBASIC (in XPsp3) write to win32 named pipe ?
Message-ID<usc8ho$114gi$1@dont-email.me>
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

[toc] | [next] | [standalone]


#4404

From"R.Wieser" <address@is.invalid>
Date2024-03-07 14:40 +0100
Message-ID<uscg50$12oo3$1@dont-email.me>
In reply to#4403
> 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

[toc] | [prev] | [next] | [standalone]


#4405

From"Auric__" <not.my.real@email.address>
Date2024-03-07 17:16 +0000
Message-ID<XnsB12E6878A3E22auricauricauricauric@135.181.20.170>
In reply to#4404
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.

[toc] | [prev] | [next] | [standalone]


#4406

From"R.Wieser" <address@is.invalid>
Date2024-03-07 19:30 +0100
Message-ID<usd13n$16hv9$1@dont-email.me>
In reply to#4405
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

[toc] | [prev] | [next] | [standalone]


#4407

FromJJ <jj4public@outlook.com>
Date2024-03-08 12:23 +0700
Message-ID<1tmrxzc3g0ohl$.tos91zz6hicr$.dlg@40tude.net>
In reply to#4403
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.

[toc] | [prev] | [next] | [standalone]


#4408

From"R.Wieser" <address@is.invalid>
Date2024-03-08 11:18 +0100
Message-ID<useone$1kpm5$1@dont-email.me>
In reply to#4407
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

[toc] | [prev] | [next] | [standalone]


#4409

FromJJ <jj4public@outlook.com>
Date2024-03-09 14:59 +0700
Message-ID<iuw2oyl49gfw.19u11f6enbxlj.dlg@40tude.net>
In reply to#4408
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.

[toc] | [prev] | [next] | [standalone]


#4410

From"R.Wieser" <address@is.invalid>
Date2024-03-09 09:56 +0100
Message-ID<ush9a1$28bf2$1@dont-email.me>
In reply to#4409
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

[toc] | [prev] | [next] | [standalone]


#4412

From"R.Wieser" <address@is.invalid>
Date2024-03-12 10:14 +0100
Message-ID<usp6ds$72s7$1@dont-email.me>
In reply to#4410
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

[toc] | [prev] | [next] | [standalone]


#4411

From"R.Wieser" <address@is.invalid>
Date2024-03-09 10:14 +0100
Message-ID<ush9a2$28bf2$2@dont-email.me>
In reply to#4403
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.msdos.programmer


csiph-web