Test for right side of a pipe?

#4
I do something like this:

Code:
wchar_t shortbuf[shortbuflen] = L"%[_transient]%[_pipe]";
ExpandVariables( shortbuf, 1 );

if ( wcscmp( shortbuf, L"00" ) == 0 ) {
    //  do stuff ....
}
I knew that (but didn't think of it, thanks). I was asking how to do it with the API (Win32 or TCC/SDK). I test for the left side of a pipe or redirection by seeing if GetConsoleScreenBufferInfo() works.

P.S. I use as little of the wcs stuff as possible; it keeps the DLL smaller. KERNEL32 exports several useful lstr... functions.
 
#5
Does isatty(fileno(stdin)) do what you want? It appears to return properly
in my tests.

On Fri, Jul 30, 2010 at 1:52 PM, vefatica <> wrote:


> ---Quote (Originally by Charles Dye)---
> I do something like this:
>
>
> Code:
> ---------
> wchar_t shortbuf[shortbuflen] = L"%[_transient]%[_pipe]";
> ExpandVariables( shortbuf, 1 );
>
> if ( wcscmp( shortbuf, L"00" ) == 0 ) {
> // do stuff ....
> }
> ---------
> ---End Quote---
> I knew that (but didn't think of it, thanks). I was asking how to do it
> with the API (Win32 or TCC/SDK). I test for the left side of a pipe or
> redirection by seeing if GetConsoleScreenBufferInfo() works.
>
> P.S. I use as little of the wcs stuff as possible; it keeps the DLL
> smaller. KERNEL32 exports several useful lstr... functions.
>
>
>
>
>


--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.