Moxa Technologies V460 Series Manual de usuario Pagina 19

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 35
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 18
V460 Series WinXP Embedded User’s Manual Getting Started
2-9
Reading Data from SRAM
// Persisted_SRAM_Read.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
DWORD dwBackSize = 0;
HANDLE hSRAM = NULL;
// open the SRAM device driver
hSRAM = CreateFile(L"\\\\.\\Sram", GENERIC_READ | GENERIC_WRITE,
0, // exclusive access, until the handle is closed
NULL, // no security
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, // no overlapped I/O
NULL); // null template
if (hSRAM == INVALID_HANDLE_VALUE)
{
printf("Can't open SRAM\n");
return 1;
}
char recvBuf[100];
memset( recvBuf, 0, sizeof(recvBuf));
// read data from SRAM
ReadFile( hSRAM, recvBuf, sizeof(recvBuf), &dwBackSize, NULL);
printf("read from SRAM: %s\n", recvBuf);
// close device driver handle
CloseHandle(hSRAM);
return 0;
}
Vista de pagina 18
1 2 ... 14 15 16 17 18 19 20 21 22 23 24 ... 34 35

Comentarios a estos manuales

Sin comentarios