# 54494 - Stdin in console apps on Windows still does not work on Windows

**URL:** <https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961>\
**Category:** Bugs and Feature Requests\
**Created:** [April 27, 2022, 8:07pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961 "2022-04-27T20:07:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [April 27, 2022, 8:07pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/1 "2022-04-27T20:07:56Z")

</div>

Feedback Case Number: 54494

54494 - Stdin in console apps on Windows still does not work on Windows now 4 years later.

Bug is archived.

1. Please reopen it.
2. How can this be ?? Xojo is selling Console as feature, and what are you supposed to do with Console apps if StdIn does not work ?

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [May 2, 2022, 6:02pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/2 "2022-05-02T18:02:27Z")

</div>

@Geoff_Perlman

So what exactly is supposed to be the process for the “Swept under the carpet bugs” that were marked as Archived ?.

This one for example is.

As far as I know there is nothing in Feedback to help me get it back to open state (I think ??’)

And posting here seems to do nothing at all, at least my post was 100% ignored and the issue is still archived.

PS. On this bug then you lost customer and had to refund at least one license back then, and I lost a customer as well since I was not quick enough to port it for them to C# when it was clear this was completely broken in Xojo. And your about to loose another now since I cannot help them ! All those years, and this bug has not even been looked at. And it makes Console applications more or less useless unless your doing something very limited with them that only takes parameters and nothing else.

---

<div class="post-metadata">

**Author:** ![Geoff\_Perlman](https://forum.xojo.com/user_avatar/forum.xojo.com/geoff_perlman/32/48_2.png) [@Geoff\_Perlman](https://forum.xojo.com/u/Geoff_Perlman)\
**Post date:** [May 2, 2022, 6:25pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/3 "2022-05-02T18:25:39Z")

</div>

You can request that a case be re-opened just click on the status and choose reopen.

---

<div class="post-metadata">

**Author:** ![kevin\_g](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kevin\_g](https://forum.xojo.com/u/kevin_g)\
**Post date:** [May 2, 2022, 7:11pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/4 "2022-05-02T19:11:32Z")

</div>

I logged 59101 two years ago as stdin.ReadAll did not work on MS-Windows.  
)-:

---

<div class="post-metadata">

**Author:** ![Robert\_filik](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/8797f3/32.png) [@Robert\_filik](https://forum.xojo.com/u/Robert_filik)\
**Post date:** [August 8, 2022, 4:21pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/5 "2022-08-08T16:21:08Z")

</div>

> [@Björn\_Eiríksson](#):
>
> ug then you lost customer and had to refund at least one license back then, and I lost a customer as well since I was not quick enough to port it for them to C# when it was clear this was completely broken in Xojo. And your about to loose another now since I cannot help them ! All those years, and this bug has not even been looked at. And it makes Console applications more or less useless unless your doing something very limited with them that only takes parameters and nothing else.

Anyone else found a workaround for this, I have the same issue?

---

<div class="post-metadata">

**Author:** ![Andrew\_Lambert](https://forum.xojo.com/user_avatar/forum.xojo.com/andrew_lambert/32/215_2.png) [@Andrew\_Lambert](https://forum.xojo.com/u/Andrew_Lambert)\
**Post date:** [August 8, 2022, 5:32pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/6 "2022-08-08T17:32:41Z")

</div>

I can’t find the bug in the bug tracker, and `stdin` appears to be working when I test it. That said, for Windows you can use declares to create a BinaryStream to read from:

```auto
Public Function Win32StdIn() As BinaryStream
  Declare Function GetStdHandle Lib "Kernel32" (HandleType As Integer) As Integer
  Declare Function DuplicateHandle Lib "Kernel32" (SourceProcessHandle As Integer, _
   SourceHandle As Integer, TargetProcessHandle As Integer, ByRef TargetHandle As Integer, _
   DesiredAccess As Integer, InheritHandle As Boolean, Options As Integer) As Boolean
  
  Const STD_INPUT_HANDLE = -10
  Const DUPLICATE_SAME_ACCESS = &h00000002
  
  Dim handle As Integer = GetStdHandle(STD_INPUT_HANDLE)
  Dim dup As Integer
  If DuplicateHandle(-1, handle, -1, dup, 0, False, DUPLICATE_SAME_ACCESS) Then 
    Dim bs As New BinaryStream(dup, BinaryStream.HandleTypeWin32Handle)
    Return bs
  End If
End Function

```

```auto
Dim stream As BinaryStream = Win32StdIn()
Dim s As String = stream.Read(1024)

```

---

<div class="post-metadata">

**Author:** ![Anthony\_G\_Cyphers](https://forum.xojo.com/user_avatar/forum.xojo.com/anthony_g_cyphers/32/16862_2.png) [@Anthony\_G\_Cyphers](https://forum.xojo.com/u/Anthony_G_Cyphers)\
**Post date:** [August 8, 2022, 5:40pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/7 "2022-08-08T17:40:04Z")

</div>

[Here it is](https://tracker.xojo.com/xojoinc/xojo/-/issues/54494).  
(Sidenote, when searching for cases by number, enter your search term including “#”. In this case, search for “#54494”)

---

<div class="post-metadata">

**Author:** ![Lawrence\_Johnson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/l/87869e/32.png) [@Lawrence\_Johnson](https://forum.xojo.com/u/Lawrence_Johnson)\
**Post date:** [August 8, 2022, 7:40pm UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/8 "2022-08-08T19:40:59Z")

</div>

@kevin_g , I’ve been following that issue too. I’ve just posted a sample of what I think may be a solution so feel free to check it out on the issues page

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [August 24, 2022, 1:37am UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/9 "2022-08-24T01:37:52Z")

</div>

This code does indeed work.

It would be great if Xojo would apply this code internally to fix the bug instead of letting the bug lay around for few more years for no good reason. Now they even got the above code to see how it needs to be so things work.

---

<div class="post-metadata">

**Author:** ![Gilles\_Plante](https://forum.xojo.com/user_avatar/forum.xojo.com/gilles_plante/32/667_2.png) [@Gilles\_Plante](https://forum.xojo.com/u/Gilles_Plante)\
**Post date:** [August 24, 2022, 3:52am UTC](https://forum.xojo.com/t/54494-stdin-in-console-apps-on-windows-still-does-not-work-on-windows/69961/10 "2022-08-24T03:52:46Z")

</div>

It has been nominated for BugBash, there are 👍 but it is not assigned 😞.
