svn path=/trunk/; revision=18776
-LPTSTR msg = "--- continue ---";
+LPTSTR msg = _T("--- continue ---");
/*handle for file and console*/
/*handle for file and console*/
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (hStdOut, &csbi);
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo (hStdOut, &csbi);
- *maxx = csbi.srWindow.Right;
- *maxy = csbi.srWindow.Bottom;
+ *maxx = (csbi.srWindow.Right - csbi.srWindow.Left) + 1;
+ *maxy = (csbi.srWindow.Bottom - csbi.srWindow.Top) - 4;
SHORT maxx,maxy;
SHORT line_count=0,ch_count=0;
INT i, last;
SHORT maxx,maxy;
SHORT line_count=0,ch_count=0;
INT i, last;
+ HANDLE hFile = INVALID_HANDLE_VALUE;
+ TCHAR szFullPath[MAX_PATH];
/*reading/writing buffer*/
TCHAR *buff;
/*reading/writing buffer*/
TCHAR *buff;
- hKeyboard = CreateFile ("CONIN$", GENERIC_READ,
+ hKeyboard = CreateFile (_T("CONIN$"), GENERIC_READ,
0,NULL,OPEN_ALWAYS,0,0);
GetScreenSize(&maxx,&maxy);
buff=malloc(4096);
0,NULL,OPEN_ALWAYS,0,0);
GetScreenSize(&maxx,&maxy);
buff=malloc(4096);
- FlushConsoleInputBuffer (hKeyboard);
+ FlushConsoleInputBuffer (hKeyboard);
+
+ if(argc > 1)
+ {
+ GetFullPathName(argv[1], MAX_PATH, szFullPath, NULL);
+ hFile = CreateFile (szFullPath, GENERIC_READ,
+ 0,NULL,OPEN_ALWAYS,0,0);
+ }
- bRet = ReadFile(hStdIn,buff,4096,&dwRead,NULL);
+ if(hFile != INVALID_HANDLE_VALUE)
+ {
+ bRet = ReadFile(hFile,buff,4096,&dwRead,NULL);
+ }
+ else
+ {
+ bRet = ReadFile(hStdIn,buff,4096,&dwRead,NULL);
+ }
for(last=i=0;i<dwRead && bRet;i++)
{
for(last=i=0;i<dwRead && bRet;i++)
{
free (buff);
CloseHandle (hKeyboard);
free (buff);
CloseHandle (hKeyboard);