Добавил:
PaniKati
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:лабораторные / лаб1 / Lab1
.c#include <windows.h>
#include <stdio.h>
int main()
{
char buffer[100] = "Readed...";
DWORD actlen;
HANDLE hstdin, hstdout;
BOOL rc;
hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (hstdout == INVALID_HANDLE_VALUE) {
printf("Error of GetStdHandle = %d", hstdout);
return(0);
}
printf("OutHNDL: %d \r\n", hstdout);
fflush(stdout);
hstdin = GetStdHandle(STD_INPUT_HANDLE);
if (hstdin == INVALID_HANDLE_VALUE) {
printf("Error of GetStdHandle hstdin = %d", hstdin);
return(0);
}
printf("InHNDL: %d \r\n", hstdin);
fflush(stdout);
printf("Enter something: ");
fflush(stdout);
rc = ReadFile(hstdin, buffer+ 18, 80, &actlen, NULL);
if(!rc)
return(0);
actlen += 18;
WriteFile(hstdout, buffer, actlen, &actlen, 0);
getchar();
}