Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

proc_out.c File Reference

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>

Go to the source code of this file.

Defines

#define STDIN   0
#define STDOUT   1
#define STDERR   2
#define CRTTONT(fh)   (HANDLE)_get_osfhandle(fh)

Functions

 PrintPair (LPWSTR pwch, UCHAR *pch, DWORD cch)
int _cdecl main (int argc, char *argv[])


Define Documentation

#define CRTTONT fh   )     (HANDLE)_get_osfhandle(fh)
 

Definition at line 11 of file proc_out.c.

Referenced by PrintPair().

#define STDERR   2
 

Definition at line 9 of file proc_out.c.

#define STDIN   0
 

Definition at line 7 of file proc_out.c.

#define STDOUT   1
 

Definition at line 8 of file proc_out.c.

Referenced by PrintPair().


Function Documentation

int _cdecl main int  argc,
char *  argv[]
 

Definition at line 41 of file proc_out.c.

References CHAR, DWORD, and PrintPair().

00041 { 00042 WCHAR awch[100]; 00043 CHAR ach[100]; 00044 CHAR ch; 00045 DWORD i, j; 00046 00047 printf("The first and second line of each pair should be identical:\n"); 00048 printf("Unicode ANSI\n"); 00049 for (i = 0xA0; i < 0xFF; i += 0x10) { 00050 for (j = 0; j < 16; j++) { 00051 awch[j] = (WCHAR)(i + j); 00052 ach[j] = (CHAR)(i+j); 00053 } 00054 PrintPair(awch, ach, 16); 00055 } 00056 00057 printf("Now test line wrapping:\n"); 00058 ch = 0x80; 00059 for (j = 0; j < 100; j++) { 00060 MultiByteToWideChar(CP_ACP, 0, &ch, 1, &awch[j], 1); 00061 ach[j] = ch; 00062 ch++; 00063 } 00064 PrintPair(awch, ach, 100); 00065 00066 }

PrintPair LPWSTR  pwch,
UCHAR *  pch,
DWORD  cch
 

Definition at line 13 of file proc_out.c.

References CRTTONT, DWORD, NULL, SetConsoleMode(), STDOUT, WriteConsoleA(), and WriteConsoleW().

Referenced by main().

00017 { 00018 DWORD cchWritten; 00019 00020 SetConsoleMode(CRTTONT(STDOUT), ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); 00021 00022 printf("%04x-%04x: ", pwch[0], pwch[cch-1]); 00023 WriteConsoleW(CRTTONT(STDOUT), pwch, cch, &cchWritten, NULL); 00024 printf(" "); 00025 printf("%02x-%02x: ", pch[0], pch[cch-1]); 00026 WriteConsoleA(CRTTONT(STDOUT), pch, cch, &cchWritten, NULL); 00027 00028 printf("\n"); 00029 SetConsoleMode(CRTTONT(STDOUT), ENABLE_WRAP_AT_EOL_OUTPUT); 00030 00031 printf("%04x-%04x: ", pwch[0], pwch[cch-1]); 00032 WriteConsoleW(CRTTONT(STDOUT), pwch, cch, &cchWritten, NULL); 00033 printf(" "); 00034 printf("%02x-%02x: ", pch[0], pch[cch-1]); 00035 WriteConsoleA(CRTTONT(STDOUT), pch, cch, &cchWritten, NULL); 00036 00037 SetConsoleMode(CRTTONT(STDOUT), ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT); 00038 printf("\n\n"); 00039 }


Generated on Sat May 15 19:45:18 2004 for test by doxygen 1.3.7