本文整理汇总了C++中printErr函数的典型用法代码示例。如果您正苦于以下问题:C++ printErr函数的具体用法?C++ printErr怎么用?C++ printErr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printErr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: serialGetC
int serialGetC(HANDLE fd, uint8_t* c, int timeout)
{
COMMTIMEOUTS timeouts;
unsigned long res;
COMSTAT comStat;
DWORD errors;
if(!ClearCommError(fd, &errors, &comStat)) {
printErr("could not reset comm errors", GetLastError());
return -1;
}
if(!GetCommTimeouts(fd, &timeouts)) {
printErr("error getting comm timeouts", GetLastError());
return -1;
}
timeouts.ReadIntervalTimeout = timeout;
timeouts.ReadTotalTimeoutConstant = timeout;
timeouts.ReadTotalTimeoutMultiplier = 10;
if(!SetCommTimeouts(fd, &timeouts)) {
printErr("error setting comm timeouts", GetLastError());
return -1;
}
if(!ReadFile(fd, c, 1, &res, NULL)) {
printErr("error reading from serial port", GetLastError());
return -1;
}
if(res != 1)
return -1;
return *c;
}
开发者ID:JiaoXianjun,项目名称:osmo-sdr,代码行数:34,代码来源:serial.c
示例2: printErr
Boolean WISInput::initALSA(UsageEnvironment& env) {
do {
int arg;
#ifdef WORDS_BIGENDIAN
arg = AFMT_S16_BE;
#else
arg = AFMT_S16_LE;
#endif
if (ioctl(fOurAudioFileNo, SNDCTL_DSP_SETFMT, &arg) < 0) {
printErr(env, "SNDCTL_DSP_SETFMT");
break;
}
arg = audioSamplingFrequency;
if (ioctl(fOurAudioFileNo, SNDCTL_DSP_SPEED, &arg) < 0) {
printErr(env, "SNDCTL_DSP_SPEED");
break;
}
arg = audioNumChannels > 1 ? 1 : 0;
if (ioctl(fOurAudioFileNo, SNDCTL_DSP_STEREO, &arg) < 0) {
printErr(env, "SNDCTL_DSP_STEREO");
break;
}
return True;
} while (0);
// An error occurred:
return False;
}
开发者ID:epheatt,项目名称:wis-streamer,代码行数:29,代码来源:WISInput.cpp
示例3: serialSetBaudrate
int serialSetBaudrate(HANDLE fd, int baudrate)
{
DCB dcb;
memset(&dcb, 0x00, sizeof(dcb));
dcb.DCBlength = sizeof(dcb);
if(!GetCommState(fd, &dcb)) {
printErr("error getting serial port state", GetLastError());
return -1;
}
dcb.BaudRate = baudrate;
dcb.ByteSize = 8;
dcb.StopBits = ONESTOPBIT;
dcb.Parity = NOPARITY;
dcb.fBinary = 1;
dcb.fOutxCtsFlow = 0;
dcb.fOutxDsrFlow = 0;
dcb.fOutX = 0;
dcb.fInX = 0;
dcb.fNull = 0;
dcb.fTXContinueOnXoff = 0;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fDsrSensitivity = 0;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
if(!SetCommState(fd, &dcb)) {
printErr("error setting serial port state", GetLastError());
return -1;
}
return 0;
}
开发者ID:JiaoXianjun,项目名称:osmo-sdr,代码行数:31,代码来源:serial.c
示例4: processor
/** \brief Set up event processing.
*
* Sets up the module for event processing, based on the options in the configuration file.
*
* \param conf Configuration file instance.
* \return Enum indicating the setup state.
*/
uint8_t Initializer::setUpEvtProc(shared_ptr<Config> conf) {
// Create event detector instance.
shared_ptr<EvtProcessor> processor(new EvtProcessor);
// Add operator for acceleration event detection.
shared_ptr<OpAcceleration> accEvents(new OpAcceleration(14000));
if (!processor->op_append(accEvents)) {
printErr(INIT_ERR_DEV_APPEND, "event operator");
return INIT_ERR_DEV_APPEND;
}
// Add operator for gyroscope event detection.
shared_ptr<OpGyroscope> gyroEvents(new OpGyroscope(1500));
if (!processor->op_append(gyroEvents)) {
printErr(INIT_ERR_DEV_APPEND, "event operator");
return INIT_ERR_DEV_APPEND;
}
// Finally add processors to event processing module.
this->evt.evt_append(processor);
this->evt.addChild(processor);
return INIT_OK;
}
开发者ID:TobiJust,项目名称:AmberOnboard,代码行数:32,代码来源:Initializer.cpp
示例5: handleTrFunctionAliases
static bool handleTrFunctionAliases(const QString &arg)
{
foreach (const QString &pair, arg.split(QLatin1Char(','), QString::SkipEmptyParts)) {
const int equalSign = pair.indexOf(QLatin1Char('='));
if (equalSign < 0) {
printErr(LU::tr("tr-function mapping '%1' in -tr-function-alias is missing the '='.\n").arg(pair));
return false;
}
const bool plusEqual = equalSign > 0 && pair[equalSign-1] == QLatin1Char('+');
const int trFunctionEnd = plusEqual ? equalSign-1 : equalSign;
const QString trFunctionName = pair.left(trFunctionEnd).trimmed();
const QString alias = pair.mid(equalSign+1).trimmed();
const int trFunction = trFunctionByDefaultName(trFunctionName);
if (trFunction < 0) {
printErr(LU::tr("Unknown tr-function '%1' in -tr-function-alias option.\n"
"Available tr-functions are: %2")
.arg(trFunctionName, availableFunctions().join(QLatin1Char(','))));
return false;
}
if (alias.isEmpty()) {
printErr(LU::tr("Empty alias for tr-function '%1' in -tr-function-alias option.\n")
.arg(trFunctionName));
return false;
}
trFunctionAliasManager.modifyAlias(trFunction, alias.toLatin1(),
plusEqual ? TrFunctionAliasManager::AddAlias : TrFunctionAliasManager::SetAlias);
}
return true;
}
开发者ID:FlavioFalcao,项目名称:qt5,代码行数:29,代码来源:main.cpp
示例6: main
int main(int argc, char** args)
{
char s[1024+1];
gets_s(s);
void* expr;
int res = ParseExpression(s, 1024, &expr);
printErr("ParseExpression", res);
if (res <= 0)
return 1;
res = PrintExpression(expr, s, 1024);
printErr("PrintExpression", res);
if (res <= 0)
return 1;
s[res] = 0;
printf("%s\n", s);
uint8 output[1024];
res = CompileExpression(expr, output, 1024, IdentifierInfoCallback);
printErr("CompileExpression", res);
if (res <= 0)
return 1;
std::ofstream f("output.bin");
f.write((char*)output, res);
f.close();
res = ReleaseExpression(expr);
printErr("ReleaseExpression", res);
if (res <= 0)
return 1;
return 0;
}
开发者ID:LordJZ,项目名称:exprcmpl,代码行数:35,代码来源:main.cpp
示例7: lsc
bool LuaInterp::loadFile( const char* fileName )
{
LuaStackCheck lsc(_luaState);
int errCode = LUA_OK;
errCode = luaL_loadfile( _luaState, fileName );
if( errCode != LUA_OK )
{
printErr( "luaL_loadfile errCode %d \"%s\"\n", errCode, lua_tolstring( _luaState, -1, 0 ) );
lua_pop( _luaState, 1 );
return false;
}
int numArgs = 0;
int numResults = 0;
int ehi = 0; // error handler index
lua_getglobal( _luaState, "debug" );
lua_getfield( _luaState, -1, "traceback" );
lua_remove( _luaState, -2 );
ehi = -2;
lua_insert( _luaState, ehi );
errCode = lua_pcall( _luaState, numArgs, numResults, ehi );
if( errCode != LUA_OK )
{
printErr( "lua_pcall %d \"%s\"\n", errCode, lua_tolstring( _luaState, -1, 0 ) );
lua_pop( _luaState, 2 );
return false;
}
lua_pop( _luaState, 1 );
return true;
}
开发者ID:ProjectAzide,项目名称:PRE,代码行数:35,代码来源:LuaInterp.cpp
示例8: releaseTranslator
static bool releaseTranslator(Translator &tor, const QString &qmFileName,
ConversionData &cd, bool removeIdentical)
{
tor.reportDuplicates(tor.resolveDuplicates(), qmFileName, cd.isVerbose());
if (cd.isVerbose())
printOut(LR::tr("Updating '%1'...\n").arg(qmFileName));
if (removeIdentical) {
if (cd.isVerbose())
printOut(LR::tr("Removing translations equal to source text in '%1'...\n").arg(qmFileName));
tor.stripIdenticalSourceTranslations();
}
QFile file(qmFileName);
if (!file.open(QIODevice::WriteOnly)) {
printErr(LR::tr("lrelease error: cannot create '%1': %2\n")
.arg(qmFileName, file.errorString()));
return false;
}
tor.normalizeTranslations(cd);
bool ok = saveQM(tor, file, cd);
file.close();
if (!ok) {
printErr(LR::tr("lrelease error: cannot save '%1': %2")
.arg(qmFileName, cd.error()));
} else if (!cd.errors().isEmpty()) {
printOut(cd.error());
}
cd.clearErrors();
return ok;
}
开发者ID:KDE,项目名称:android-qt,代码行数:33,代码来源:main.cpp
示例9: initConfig
/*
* Function to initialize global config struct
*/
static Config initConfig(CMap cmap) {
char * val;
int i = 0;
Config c = mallocConfig();
FILE * file = fopen(DEFAULT_OPTIONS_FILENAME, "r");
if (file == NULL) {
die("Default config file not found.", 2);
}
defCMap = getCMap(file); /* Load default config map from file */
for (i = 0; i < ARYLEN; ++i) { /* Load default values into config ary 1st */
config[i].value = getCValue(defCMap, config[i].keyword);
}
for (i = 0; i < ARYLEN; ++i) {
val = getCValue(cmap, config[i].keyword); /* get user config value */
if (val != NULL) {
if (!setConfigValue(c, i, val)) /* check & set configuration */
printErr("Invalid parameter value: ", "initConfig()", 1); /* ... or log an error */
}
else if (!setConfigValue(c, i, config[i].value))
printErr("Error in default config file: ", "initConfig()", 1);
}
fclose(file);
return c;
}
开发者ID:joseph8th,项目名称:unm-cs,代码行数:31,代码来源:configSPQR.c
示例10: getConeFloatArr
static int getConeFloatArr(char *key, scs_float **varr, scs_int *vsize,
PyObject *cone) {
/* get cone['key'] */
scs_int i, n = 0;
scs_float *q = SCS_NULL;
PyObject *obj = PyDict_GetItemString(cone, key);
if (obj) {
if (PyList_Check(obj)) {
n = (scs_int)PyList_Size(obj);
q = scs_calloc(n, sizeof(scs_float));
for (i = 0; i < n; ++i) {
PyObject *qi = PyList_GetItem(obj, i);
q[i] = (scs_float)PyFloat_AsDouble(qi);
}
} else if (PyInt_Check(obj) || PyLong_Check(obj) ||
PyFloat_Check(obj)) {
n = 1;
q = scs_malloc(sizeof(scs_float));
q[0] = (scs_float)PyFloat_AsDouble(obj);
} else {
return printErr(key);
}
if (PyErr_Occurred()) {
/* potentially could have been triggered before */
return printErr(key);
}
}
*vsize = n;
*varr = q;
return 0;
}
开发者ID:akshayka,项目名称:scs,代码行数:31,代码来源:scsmodule.c
示例11: welcome
void welcome()
{
int cnt;
//open the count file.
FILE* fp = fopen((PWD + "/Config/counts.txt").c_str(),"r+");
//file error check.
if(!fp)
printErr(COUNT_FILE_ERROR);
//incrementing the count.
if(fscanf(fp, "%d", &cnt))
{
if(cnt==0)
{
giveIntro();
}
}
else
printErr(COUNT_FILE_ERROR);
}
开发者ID:mayank2903,项目名称:code-kick-starter,代码行数:25,代码来源:welcome_note.cpp
示例12: print
static void print(const QString &fileName, int lineNo, const QString &msg)
{
if (lineNo)
printErr(QString::fromLatin1("%2(%1): %3").arg(lineNo).arg(fileName, msg));
else
printErr(msg);
}
开发者ID:KDE,项目名称:android-qt,代码行数:7,代码来源:main.cpp
示例13: main
int main(int argc, char *argv[])
{
int rc = 0;
if (argc == 3 || argc == 5)
{
struct stat DirStat;
if ( stat(argv[2], &DirStat) == 0
&& S_ISDIR(DirStat.st_mode))
{
char *pszContent;
rc = readFile(argv[1], &pszContent, NULL);
if (!rc)
{
FILE *pFileList = NULL;
if (argc == 5)
rc = openMakefileList(argv[3], argv[4], &pFileList);
if (argc < 4 || pFileList)
rc = splitFile(argv[2], pszContent, pFileList);
if (pFileList)
rc = closeMakefileList(pFileList, rc);
free(pszContent);
}
}
else
rc = printErr("Given argument \"%s\" is not a valid directory.\n", argv[2]);
}
else
rc = printErr("Syntax error: usage: filesplitter <infile> <outdir> [<list.kmk> <kmkvar>]\n");
return rc;
}
开发者ID:bringhurst,项目名称:vbox,代码行数:33,代码来源:filesplitter.cpp
示例14: printErr
STATUS wdbUdpSockIfInit
(
WDB_COMM_IF * pWdbCommIf
)
{
struct sockaddr_in srvAddr;
pWdbCommIf->rcvfrom = wdbUdpSockRcvfrom;
pWdbCommIf->sendto = wdbUdpSockSendto;
pWdbCommIf->modeSet = wdbUdpSockModeSet;
pWdbCommIf->cancel = wdbUdpSockCancel;
pWdbCommIf->hookAdd = NULL;
pWdbCommIf->notifyHost = NULL;
/* Create the wdbUdpSocket */
if ((wdbUdpSock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
printErr ("Socket failed\n");
return (ERROR);
}
/* Bind to WDB agents port number */
bzero ((char *)&srvAddr, sizeof(srvAddr));
srvAddr.sin_family = AF_INET;
srvAddr.sin_port = htons(WDBPORT);
srvAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind (wdbUdpSock, (struct sockaddr *)&srvAddr, sizeof(srvAddr)) < 0 )
{
printErr ("Bind failed\n");
return (ERROR);
}
/* Create the wdbUdpCancelSocket */
if ((wdbUdpCancelSock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
printErr ("Socket failed\n");
return (ERROR);
}
/* connect it (for writes) to the wdbUdpSocket */
bzero ((char *)&srvAddr, sizeof(srvAddr));
srvAddr.sin_family = AF_INET;
srvAddr.sin_port = htons(WDBPORT);
srvAddr.sin_addr.s_addr = inet_addr ("127.0.0.1");
if (connect (wdbUdpCancelSock, (struct sockaddr *)&srvAddr, sizeof(srvAddr))
== ERROR)
{
printErr ("Connect failed\n");
return (ERROR);
}
return (OK);
}
开发者ID:andy345,项目名称:vxworks5,代码行数:58,代码来源:wdbUdpSockLib.c
示例15: print
static void print(const QString &fileName, int lineNo, const QString &msg)
{
if (lineNo > 0)
printErr(QString::fromLatin1("WARNING: %1:%2: %3\n").arg(fileName, QString::number(lineNo), msg));
else if (lineNo)
printErr(QString::fromLatin1("WARNING: %1: %2\n").arg(fileName, msg));
else
printErr(QString::fromLatin1("WARNING: %1\n").arg(msg));
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:9,代码来源:main.cpp
示例16: discovery
/**********************************************************************
*%FUNCTION: discovery
*%ARGUMENTS:
* conn -- PPPoE connection info structure
*%RETURNS:
* Nothing
*%DESCRIPTION:
* Performs the PPPoE discovery phase
***********************************************************************/
void
discovery(PPPoEConnection *conn)
{
int padiAttempts = 0;
int padrAttempts = 0;
int timeout = conn->discoveryTimeout;
conn->discoverySocket =
openInterface(conn->ifName, Eth_PPPOE_Discovery, conn->myEth);
do {
padiAttempts++;
if (padiAttempts > MAX_PADI_ATTEMPTS) {
printErr("Timeout waiting for PADO packets");
close(conn->discoverySocket);
conn->discoverySocket = -1;
return;
}
sendPADI(conn);
conn->discoveryState = STATE_SENT_PADI;
waitForPADO(conn, timeout);
timeout *= 3;
if (timeout > 60)
timeout = 10;
} while (conn->discoveryState == STATE_SENT_PADI);
timeout = conn->discoveryTimeout;
do {
padrAttempts++;
if (padrAttempts > MAX_PADI_ATTEMPTS) {
printErr("Timeout waiting for PADS packets");
close(conn->discoverySocket);
conn->discoverySocket = -1;
return;
}
sendPADR(conn);
conn->discoveryState = STATE_SENT_PADR;
waitForPADS(conn, timeout);
timeout *= 3;
if (timeout > 60)
timeout = 10;
} while (conn->discoveryState == STATE_SENT_PADR);
if (!conn->seenMaxPayload) {
/* RFC 4638: MUST limit MTU/MRU to 1492 */
if (lcp_allowoptions[0].mru > ETH_PPPOE_MTU)
lcp_allowoptions[0].mru = ETH_PPPOE_MTU;
if (lcp_wantoptions[0].mru > ETH_PPPOE_MTU)
lcp_wantoptions[0].mru = ETH_PPPOE_MTU;
}
/* We're done. */
conn->discoveryState = STATE_SESSION;
return;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:66,代码来源:discovery.c
示例17: printUnhandledException
void printUnhandledException(const char *iname, const std::exception *e)
{
if (e)
printErr(iname,"unhandled exception: %s\n", prettyName(e->what()));
else
printErr(iname,"internal error: unhandled exception!\n");
if (opt->cmd != CMD_COMPRESS)
{
printErr(iname," this file has possibly been modified/hacked; take care!\n");
}
}
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:11,代码来源:msg.cpp
示例18: memset
void WISVideoOpenFileSource::readFromFile() {
// Retrieve a filled video buffer from the kernel:
unsigned i;
struct v4l2_buffer buf;
if (capture_start) {
capture_start = 0;
for (i = 0; i < MAX_BUFFERS; ++i) {
memset(&buf, 0, sizeof buf);
buf.index = i;
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
if (ioctl(fFileNo, VIDIOC_QBUF, &buf) < 0) {
printErr(envir(), "VIDIOC_QBUF");
return;
}
}
// Start capturing:
i = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if (ioctl(fFileNo, VIDIOC_STREAMON, &i) < 0) {
printErr(envir(), "VIDIOC_STREAMON");
return;
}
}
memset(&buf, 0, sizeof buf);
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
if (ioctl(fFileNo, VIDIOC_DQBUF, &buf) < 0) {
printErr(envir(), "VIDIOC_DQBUF");
return;
}
// Note the timestamp and size:
fPresentationTime = buf.timestamp;
fFrameSize = buf.bytesused;
if (fFrameSize > fMaxSize) {
fNumTruncatedBytes = fFrameSize - fMaxSize;
fFrameSize = fMaxSize;
} else {
fNumTruncatedBytes = 0;
}
// Copy to the desired place:
memmove(fTo, buffers[buf.index].addr, fFrameSize);
// Send the buffer back to the kernel to be filled in again:
if (ioctl(fFileNo, VIDIOC_QBUF, &buf) < 0) {
printErr(envir(), "VIDIOC_QBUF");
return;
}
}
开发者ID:epheatt,项目名称:wis-streamer,代码行数:53,代码来源:WISInput.cpp
示例19: colFileLoader
__MSSHELL_WRAPPER_ __WINCALL static void _MS__private __system colFileLoader(const sel_typ argc, char ** argv)
{
char path[MAX_PATH_LENGTH];
#ifdef WINOS
if(isnSett(BOOLS_ITEMSSELECTBYPATH))
{
const bool wHandler = windowsFileHandler(path, "Settings Configuration (*."DEFAULT_COLORS_FILE_EXTENSION")\0*."DEFAULT_COLORS_FILE_EXTENSION"\0Text Documents (*.txt)\0*.txt\0All Files (*.*)\0*.*\0",
DEFAULT_COLORS_FILE_EXTENSION, true);
if(wHandler)
{
_colFileLoader(path);
sprint("%s\nFile has been correctly loaded.\n\n", path);
}
else
printErr(14, "Failed to select Colors Settings File");
}
else
#endif
{
if(argc)
{
if(!file_exists(argv[0]))
{
printErr(2, "Inserted Path:\n%s\nrefers to non-existent File", argv[0]);
return;
}
strcpy(path, argv[0]);
}
else
{
bool assert;
printf2(COLOR_CREDITS, "Enter the Path of the "DEFAULT_LAYOUT_FILE_EXTENSION" File you wish to load.\n");
printf2(COLOR_CREDITS, "or insert %c to exit SubProgram.\n\n", SCANFEXIT_CHAR);
PRINTL();
while(scanf("%s", path) != 1 || path[0] == SCANFEXIT_CHAR || (assert = !file_exists(path)))
{
CLEARBUFFER();
if(path[0] == SCANFEXIT_CHAR) return;
if(assert)
{
printErr(2, "Inserted Path:\n%s\nrefers to non-existent File", argv[0]);
return;
}
// mustcreatefile = true;
}
}
_colFileLoader(path);
sprint("%s\nFile has been correctly loaded.\n\n", path);
}
return;
}
开发者ID:DekraN,项目名称:mathSuite,代码行数:53,代码来源:cols_manager.c
示例20: disk
STATUS usrFdConfig
(
int drive, /* drive number of floppy disk (0 - 3) */
int type, /* type of floppy disk */
char * fileName /* mount point */
)
{
BLK_DEV *pBootDev;
CBIO_DEV_ID cbio ;
char bootDir [BOOT_FILE_LEN];
if( type == NONE)
return OK;
if ((UINT)drive >= FD_MAX_DRIVES)
{
printErr ("drive is out of range (0-%d).\n", FD_MAX_DRIVES - 1);
return (ERROR);
}
/* create a block device spanning entire disk (non-distructive!) */
if ((pBootDev = fdDevCreate (drive, type, 0, 0)) == NULL)
{
printErr ("fdDevCreate failed.\n");
return (ERROR);
}
/* create a disk cache to speed up Floppy operation */
cbio = dcacheDevCreate( (CBIO_DEV_ID) pBootDev, NULL,
FD_CACHE_SIZE, bootDir );
if( cbio == NULL )
{
/* insufficient memory, will avoid the cache */
cbio = cbioWrapBlkDev (pBootDev);
}
/* split off boot device from boot file */
devSplit (fileName, bootDir);
/* initialize device as a dosFs device named <bootDir> */
if (dosFsDevCreate (bootDir, cbio, 20, NONE) == ERROR)
{
printErr ("dosFsDevCreate failed.\n");
return (ERROR);
}
return (OK);
}
开发者ID:andy345,项目名称:vxworks5,代码行数:52,代码来源:usrFd.c
注:本文中的printErr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论