home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 February
/
Chip_2002-02_cd1.bin
/
sharewar
/
apaths
/
APSOURCE.ZIP
/
SysError.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-03-26
|
979b
|
39 lines
/* SysError - March 26th, 2001
**
** Copyright (c) 1997-2001 by Gregory Braun. All rights reserved.
**
** This module retrieves the most recent system error message string.
**
** Called: err = current system error code.
** string = string buffer to be filled.
**
** Returns: System error message.
*/
#include "AppPaths.h"
extern LPSTR far SysError (DWORD err,LPSTR string)
{
auto int len;
auto char msg[PSTRING];
*msg = EOS;
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
err,
MAKELANGID (LANG_NEUTRAL,SUBLANG_DEFAULT),
msg,
PSTRING - 1,
NULL);
if ((len = lstrlen (msg)) > 2) // trim the CR/LF termination
msg[len - 2] = EOS;
lstrcpy (string,msg);
return (string);
}
/* end of SysError.c - written by Gregory Braun */