Console exe up / down history

Sep 8, 2008
26
0
I have a simple console application. When I run in tcc and when there is a prompt from my console.exe, the up/down show history. However, with Take Command the up/down do not show history. Any ideas why?
 

rconn

Administrator
Staff member
May 14, 2008
11,894
133
I don't understand what you're doing here - TCC is not going to show command history if you're in another app, whether or not it's in a TCMD tab window. You'll only get history if you're at the TCC prompt.

You can send the app to support@jpsoft.com & more details on what you're doing, but from what I've seen so far I don't think this is a supported environment.
 
May 20, 2008
10,498
77
Syracuse, NY, USA
Hmmm! I'm curious here. You get a history mechanism free in a console app (I never knew that!). This little app (below) has a working Up (HistPrev), Dn (HistNext), and F9 (goto history line) ... maybe more. But it works just as well in TCMD as in a stand-alone console (even the console-based F9 "dialog"). So I still wonder what gmorris59's issue is.

INT wmain ( INT argc, LPWSTR *argv )
{
WCHAR buf[256];
while (TRUE)
{
_getws_s(buf, 256);
wprintf(L"%s\n", buf);
}
return 0;
}

I always wondered what the console's Properties\Options\CommandHistory\BufferSize was all about. Now I know; it's all about this free history mechanism.
 
Sep 8, 2008
26
0
I wrote exactly the same in C# and its good that the "local history" within the application works. However for me sometimes it does not work and I can;'t understand particularly when the app is so small
 

rconn

Administrator
Staff member
May 14, 2008
11,894
133
Windows provides some (limited) history and line editing features with the ReadConsole API. This is what CMD uses (and any apps that use ReadConsole to get their input). TCC has an .INI option to use that API if you really want bad line editing, but normally TCC reads the console input a character at a time and does its own editing & history recall.