Deditec USB-TTL-32 Ficha De Dados

Página de 58
DELIB API reference | Seite
53
4.6. Example program
//***************************************************************************
//***************************************************************************
//***************************************************************************
//***************************************************************************
//***************************************************************************
//
//
//  product: usb-ttl-32 (ModuleID = USB_TTL_32)
//  configuration: ttl-io
//  programming language: vc
//
//
//  (c) DEDITEC GmbH, 2011
//  web: http://www.deditec.de/
//  mail: vertrieb@deditec.de
//
// 
//***************************************************************************
//***************************************************************************
//***************************************************************************
//***************************************************************************
//***************************************************************************
//
//
// Please include the following library on linking: delib.lib
//
// This can be done at the project settings (Project/Settings/Link -> 
// Object/library modules) .. extend the existing line with the ending 
// "$(DELIB_LIB)\delib.lib"
(with quotation marks)
//
// Including the header file delib.h (Project/Settings/C/C++ -> select
category 
// "Preprocessor" -> Additional inlude directories) .. enter the line 
// "$(DELIB_INCLUDE)"
(with quotation marks)
#include <windows.h>
#include <stdio.h>
#include "conio.h"
#include "delib.h"
// ---------------------------------------------------------------------------
// GetLastError function
BOOL IsError()
{
unsigned char msg[500];
if (DapiGetLastError() != DAPI_ERR_NONE)
{
DapiGetLastErrorText((unsigned char*) msg, sizeof(msg));
printf("Error Code = %x * Message = %s\n", 0, msg);