这篇教程C++ sstrcpy函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sstrcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ sstrcpy函数的具体用法?C++ sstrcpy怎么用?C++ sstrcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sstrcpy函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: iV_saveImage_JPEGvoid iV_saveImage_JPEG(const char *fileName, const iV_Image *image){ unsigned char *buffer = NULL; unsigned char *jpeg = NULL; char newfilename[PATH_MAX]; unsigned int currentRow; const unsigned int row_stride = image->width * 3; // 3 bytes per pixel PHYSFS_file* fileHandle; unsigned char *jpeg_end; sstrcpy(newfilename, fileName); memcpy(newfilename + strlen(newfilename) - 4, ".jpg", 4); fileHandle = PHYSFS_openWrite(newfilename); if (fileHandle == NULL) { debug(LOG_ERROR, "pie_JPEGSaveFile: PHYSFS_openWrite failed (while opening file %s) with error: %s/n", fileName, PHYSFS_getLastError()); return; } buffer = (unsigned char *)malloc(sizeof(const char*) * image->height * image->width); // Suspect it should be sizeof(unsigned char)*3 == 3 here, not sizeof(const char *) == 8. if (buffer == NULL) { debug(LOG_ERROR, "pie_JPEGSaveFile: Couldn't allocate memory/n"); return; } // Create an array of scanlines for (currentRow = 0; currentRow < image->height; ++currentRow) { // We're filling the scanline from the bottom up here, // otherwise we'd have a vertically mirrored image. memcpy(buffer + row_stride * currentRow, &image->bmp[row_stride * (image->height - currentRow - 1)], row_stride); } jpeg = (unsigned char *)malloc(sizeof(const char*) * image->height * image->width); // Suspect it should be something else here, but sizeof(const char *) == 8 is hopefully big enough... if (jpeg == NULL) { debug(LOG_ERROR, "pie_JPEGSaveFile: Couldn't allocate memory/n"); free(buffer); return; } jpeg_end = jpeg_encode_image(buffer, jpeg, 1, JPEG_FORMAT_RGB, image->width, image->height); PHYSFS_write(fileHandle, jpeg, jpeg_end - jpeg, 1); free(buffer); free(jpeg); PHYSFS_close(fileHandle);}
开发者ID:BG1,项目名称:warzone2100,代码行数:49,
示例2: switchconst char *objInfo(const BASE_OBJECT *psObj){ static char info[PATH_MAX]; switch (psObj->type) { case OBJ_DROID: { const DROID *psDroid = (const DROID *)psObj; return droidGetName(psDroid); } case OBJ_STRUCTURE: { const STRUCTURE *psStruct = (const STRUCTURE *)psObj; return getName(psStruct->pStructureType->pName); } case OBJ_FEATURE: { const FEATURE *psFeat = (const FEATURE *)psObj; return getName(psFeat->psStats->pName); } case OBJ_PROJECTILE: sstrcpy(info, "Projectile"); // TODO break; case OBJ_TARGET: sstrcpy(info, "Target"); // TODO break; default: sstrcpy(info, "Unknown object type"); break; } return info;}
开发者ID:DylanHsu,项目名称:warzone2100,代码行数:36,
示例3: version_getVcsDateconst char* version_getVcsDate(){#if (VCS_NUM == 0) return "";#else static char vcs_date[sizeof(vcs_date_cstr) - 9] = { '/0' }; if (vcs_date[0] == '/0') { sstrcpy(vcs_date, vcs_date_cstr); } return vcs_date;#endif}
开发者ID:HalezovaKs,项目名称:warzone2100,代码行数:15,
示例4: pie_LoadBackDropvoid pie_LoadBackDrop(SCREENTYPE screenType){ char backd[128]; //randomly load in a backdrop piccy. srand( (unsigned)time(NULL) + 17 ); // Use offset since time alone doesn't work very well switch (screenType) { case SCREEN_RANDOMBDROP: snprintf(backd, sizeof(backd), "texpages/bdrops/backdrop%i.png", rand() % NUM_BACKDROPS); // Range: 0 to (NUM_BACKDROPS-1) break; case SCREEN_MISSIONEND: sstrcpy(backd, "texpages/bdrops/missionend.png"); break; case SCREEN_CREDITS: default: sstrcpy(backd, "texpages/bdrops/credits.png"); break; } screen_SetBackDropFromFile(backd);}
开发者ID:wildsoul,项目名称:warzone2100,代码行数:24,
示例5: version_getSvnDateconst char* version_getSvnDate(){#if (SVN_REV == 0) return "";#else static char svn_date[sizeof(svn_date_cstr) - 9] = { '/0' }; if (svn_date[0] == '/0') { sstrcpy(svn_date, svn_date_cstr); } return svn_date;#endif}
开发者ID:DylanHsu,项目名称:warzone2100,代码行数:15,
示例6: sstrcat/** * Safe strcat */static void sstrcat(char *dest,const char*source,size_t size){ size_t length = strlen(dest); if (length < size) { sstrcpy(dest+length,source,size - length); } else { LWIP_DEBUGF(GPRS_DEBUG,("gprs: sstrcat() String overflow short size=%u length=%u",size,length)); LWIP_ASSERT("gprs: sstrcat()",length < size); }}
开发者ID:MarioViara,项目名称:gprs,代码行数:18,
示例7: hostCampaign// ////////////////////////////////////////////////////////////////////////////// Host Campaign.bool hostCampaign(char *sGame, char *sPlayer){ PLAYERSTATS playerStats; UDWORD i; debug(LOG_WZ, "Hosting campaign: '%s', player: '%s'", sGame, sPlayer); freeMessages(); // If we had a single player (i.e. campaign) game before this value will // have been set to 0. So revert back to the default value. if (game.maxPlayers == 0) { game.maxPlayers = 4; } if (!NEThostGame(sGame, sPlayer, game.type, 0, 0, 0, game.maxPlayers)) { return false; } for (i = 0; i < MAX_PLAYERS; i++) { if (NetPlay.bComms) { game.skDiff[i] = 0; // disable AI } setPlayerName(i, ""); //Clear custom names (use default ones instead) } NetPlay.players[selectedPlayer].ready = false; ingame.localJoiningInProgress = true; ingame.JoiningInProgress[selectedPlayer] = true; bMultiPlayer = true; bMultiMessages = true; // enable messages loadMultiStats(sPlayer, &playerStats); // stats stuff setMultiStats(selectedPlayer, playerStats, false); setMultiStats(selectedPlayer, playerStats, true); if (!NetPlay.bComms) { sstrcpy(NetPlay.players[0].name, sPlayer); } return true;}
开发者ID:Zabanya,项目名称:warzone2100,代码行数:50,
示例8: initI18nvoid initI18n(void){ const char *textdomainDirectory = NULL; if (!setLanguage("")) // set to system default { // no system default? debug(LOG_ERROR, "initI18n: No system language found"); }#if defined(WZ_OS_WIN) { // Retrieve an absolute path to the locale directory char localeDir[PATH_MAX]; sstrcpy(localeDir, PHYSFS_getBaseDir()); sstrcat(localeDir, "//" LOCALEDIR); // Set locale directory and translation domain name textdomainDirectory = bindtextdomain(PACKAGE, localeDir); }#else #ifdef WZ_OS_MAC { char resourcePath[PATH_MAX]; CFURLRef resourceURL = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle()); if( CFURLGetFileSystemRepresentation( resourceURL, true, (UInt8 *) resourcePath, PATH_MAX) ) { sstrcat(resourcePath, "/locale"); textdomainDirectory = bindtextdomain(PACKAGE, resourcePath); } else { debug( LOG_ERROR, "Could not change to resources directory." ); } debug(LOG_INFO, "resourcePath is %s", resourcePath); } #else textdomainDirectory = bindtextdomain(PACKAGE, LOCALEDIR); #endif#endif if (!textdomainDirectory) { debug(LOG_ERROR, "initI18n: bindtextdomain failed!"); } (void)bind_textdomain_codeset(PACKAGE, "UTF-8"); (void)textdomain(PACKAGE);}
开发者ID:cybersphinx,项目名称:wzgraphicsmods,代码行数:48,
示例9: WIDGETW_LABEL::W_LABEL(W_LABINIT const *init) : WIDGET(init, WIDG_LABEL) , FontID(init->FontID) , pTip(init->pTip){ if (display == NULL) { display = labelDisplay; } aText[0] = '/0'; if (init->pText) { sstrcpy(aText, init->pText); }}
开发者ID:ArtemusRus,项目名称:warzone2100,代码行数:16,
示例10: newPage// Generate a new texture page both in the texture page table, and on the graphics cardstatic int newPage(const char *name, int level, int width, int height, int count){ int texPage = firstPage + ((count + 1) / TILES_IN_PAGE); // debug(LOG_TEXTURE, "newPage: texPage=%d firstPage=%d %s %d (%d,%d) (count %d + 1) / %d _TEX_INDEX=%u", // texPage, firstPage, name, level, width, height, count, TILES_IN_PAGE, _TEX_INDEX); if (texPage == _TEX_INDEX) { // We need to create a new texture page; create it and increase texture table to store it glGenTextures(1, &_TEX_PAGE[texPage].id); _TEX_INDEX++; } terrainPage = texPage; ASSERT(_TEX_INDEX > texPage, "newPage: Index too low (%d > %d)", _TEX_INDEX, texPage); ASSERT(_TEX_INDEX < iV_TEX_MAX, "Too many texture pages used"); sstrcpy(_TEX_PAGE[texPage].name, name); pie_SetTexturePage(texPage); // Specify first and last mipmap level to be used glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmap_levels - 1); // debug(LOG_TEXTURE, "newPage: glTexImage2D(page=%d, level=%d) opengl id=%u", texPage, level, _TEX_PAGE[texPage].id); glTexImage2D(GL_TEXTURE_2D, level, wz_texture_compression, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Use anisotropic filtering, if available, but only max 4.0 to reduce processor burden if (GLEW_EXT_texture_filter_anisotropic) { GLfloat max; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, MIN(4.0f, max)); } return texPage;}
开发者ID:michederoide,项目名称:warzone2100,代码行数:46,
示例11: do_modem_init/** * Send the command to initialize the gprs of the modem. */static void do_modem_init(gprs_t * gprs){ UNTIMEOUT(); gprs_set_state(gprs,GPRS_STATE_MODEM_INIT); sstrcpy(gprs->replyBuffer,"AT+CGDCONT=1,/"IP/",/"",sizeof(gprs->replyBuffer));#if GPRS_RUNTIME_APN sstrcat(gprs->replyBuffer,gprs->apn,sizeof(gprs->replyBuffer));#else sstrcat(gprs->replyBuffer,GPRS_APN,sizeof(gprs->replyBuffer));#endif sstrcat(gprs->replyBuffer,"/"",sizeof(gprs->replyBuffer)); gprs_command(gprs,gprs->replyBuffer,'/r');}
开发者ID:MarioViara,项目名称:gprs,代码行数:21,
示例12: resAlloc/* Allocate a RES_TYPE structure */static RES_TYPE* resAlloc(const char *pType){ RES_TYPE *psT;#ifdef DEBUG // Check for a duplicate type for(psT = psResTypes; psT; psT = psT->psNext) { ASSERT(strcmp(psT->aType, pType) != 0, "Duplicate function for type: %s", pType); }#endif // setup the structure psT = (RES_TYPE *)malloc(sizeof(RES_TYPE)); sstrcpy(psT->aType, pType); psT->HashedType = HashString(psT->aType); // store a hased version for super speed ! psT->psRes = NULL; return psT;}
开发者ID:Cjkjvfnby,项目名称:warzone2100,代码行数:21,
示例13: recvBeaconstatic bool recvBeacon(NETQUEUE queue){ int32_t sender, receiver,locX, locY; char msg[MAX_CONSOLE_STRING_LENGTH]; NETbeginDecode(queue, NET_BEACONMSG); NETint32_t(&sender); // the actual sender NETint32_t(&receiver); // the actual receiver (might not be the same as the one we are actually sending to, in case of AIs) NETint32_t(&locX); NETint32_t(&locY); NETstring(msg, sizeof(msg)); // Receive the actual message NETend(); debug(LOG_WZ, "Received beacon for player: %d, from: %d",receiver, sender); sstrcat(msg, NetPlay.players[sender].name); // name sstrcpy(beaconReceiveMsg[sender], msg); return addBeaconBlip(locX, locY, receiver, sender, beaconReceiveMsg[sender]);}
开发者ID:mikevdg,项目名称:warzone2100-pathing,代码行数:20,
示例14: registerSearchPath/*! * Register searchPath above the path with next lower priority * For information about what can be a search path, refer to PhysFS documentation */void registerSearchPath( const char path[], unsigned int priority ){ wzSearchPath * curSearchPath = searchPathRegistry, * tmpSearchPath = NULL; tmpSearchPath = (wzSearchPath*)malloc(sizeof(*tmpSearchPath)); sstrcpy(tmpSearchPath->path, path); if (path[strlen(path)-1] != *PHYSFS_getDirSeparator()) sstrcat(tmpSearchPath->path, PHYSFS_getDirSeparator()); tmpSearchPath->priority = priority; debug( LOG_WZ, "registerSearchPath: Registering %s at priority %i", path, priority ); if ( !curSearchPath ) { searchPathRegistry = tmpSearchPath; searchPathRegistry->lowerPriority = NULL; searchPathRegistry->higherPriority = NULL; return; } while( curSearchPath->higherPriority && priority > curSearchPath->priority ) curSearchPath = curSearchPath->higherPriority; while( curSearchPath->lowerPriority && priority < curSearchPath->priority ) curSearchPath = curSearchPath->lowerPriority; if ( priority < curSearchPath->priority ) { tmpSearchPath->lowerPriority = curSearchPath->lowerPriority; tmpSearchPath->higherPriority = curSearchPath; } else { tmpSearchPath->lowerPriority = curSearchPath; tmpSearchPath->higherPriority = curSearchPath->higherPriority; } if( tmpSearchPath->lowerPriority ) tmpSearchPath->lowerPriority->higherPriority = tmpSearchPath; if( tmpSearchPath->higherPriority ) tmpSearchPath->higherPriority->lowerPriority = tmpSearchPath;}
开发者ID:kerbys,项目名称:warzone2100,代码行数:44,
示例15: OverrideRPTDirectorybool OverrideRPTDirectory(char *newPath){# if defined(WZ_CC_MINGW) wchar_t buf[MAX_PATH]; if (!MultiByteToWideChar(CP_UTF8, 0, newPath, -1, buf, MAX_PATH)) { //conversion failed-- we won't use the user's directory. LPVOID lpMsgBuf; DWORD dw = GetLastError(); TCHAR szBuffer[4196]; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL); wsprintf(szBuffer, _T("Exception handler failed setting new directory with error %d: %s/n"), dw, lpMsgBuf); MessageBox((HWND)MB_ICONEXCLAMATION, szBuffer, _T("Error"), MB_OK); LocalFree(lpMsgBuf); return false; } PathRemoveFileSpecW(buf); wcscat(buf, L"//logs//"); // stuff it in the logs directory wcscat(buf, L"Warzone2100.RPT"); ResetRPTDirectory(buf);#elif defined(WZ_OS_UNIX) && !defined(WZ_OS_MAC) sstrcpy(WritePath, newPath);#endif return true;}
开发者ID:C1annad,项目名称:warzone2100,代码行数:39,
示例16: seq_AddSeqToList//add a sequence to the list to be playedvoid seq_AddSeqToList(const char *pSeqName, const char *pAudioName, const char *pTextName, BOOL bLoop){ currentSeq++; ASSERT(currentSeq < MAX_SEQ_LIST, "too many sequences"); if (currentSeq >= MAX_SEQ_LIST) { return; } //OK so add it to the list aSeqList[currentSeq].pSeq = pSeqName; aSeqList[currentSeq].pAudio = pAudioName; aSeqList[currentSeq].bSeqLoop = bLoop; if (pTextName != NULL) { // Ordinary text shouldn't be justified seq_AddTextFromFile(pTextName, SEQ_TEXT_POSITION); } if (bSeqSubtitles) { char aSubtitleName[MAX_STR_LENGTH]; size_t check_len = sstrcpy(aSubtitleName, pSeqName); char* extension; ASSERT(check_len < sizeof(aSubtitleName), "given sequence name (%s) longer (%lu) than buffer (%lu)", pSeqName, (unsigned long) check_len, (unsigned long) sizeof(aSubtitleName)); // check for a subtitle file extension = strrchr(aSubtitleName, '.'); if (extension) *extension = '/0'; check_len = sstrcat(aSubtitleName, ".txt"); ASSERT(check_len < sizeof(aSubtitleName), "sequence name to long to attach an extension too"); // Subtitles should be center justified seq_AddTextFromFile(aSubtitleName, SEQ_TEXT_JUSTIFY); }}
开发者ID:cybersphinx,项目名称:wzgraphicsmods,代码行数:40,
示例17: displayLoadSlot// ////////////////////////////////////////////////////////////////////////////static void displayLoadSlot(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset){ int x = xOffset + psWidget->x(); int y = yOffset + psWidget->y(); char butString[64]; drawBlueBox(x, y, psWidget->width(), psWidget->height()); //draw box if (!((W_BUTTON *)psWidget)->pText.isEmpty()) { sstrcpy(butString, ((W_BUTTON *)psWidget)->pText.toUtf8().constData()); iV_SetFont(font_regular); // font iV_SetTextColour(WZCOL_FORM_TEXT); while(iV_GetTextWidth(butString) > psWidget->width()) { butString[strlen(butString)-1]='/0'; } //draw text iV_DrawText( butString, x+4, y+17); }}
开发者ID:Cjkjvfnby,项目名称:warzone2100,代码行数:25,
示例18: setupExceptionHandler/** * Setup the exception handler responsible for target OS. * * /param programCommand Command used to launch this program. Only used for POSIX handler. */void setupExceptionHandler(int argc, const char ** argv){#if defined(WZ_OS_UNIX) && !defined(WZ_OS_MAC) const char *programCommand; time_t currentTime;#endif#if !defined(WZ_OS_MAC) // Initialize info required for the debug dumper dbgDumpInit(argc, argv);#endif#if defined(WZ_OS_WIN)# if defined(WZ_CC_MINGW) ExchndlSetup();# else prevExceptionHandler = SetUnhandledExceptionFilter(windowsExceptionHandler);# endif // !defined(WZ_CC_MINGW)#elif defined(WZ_OS_UNIX) && !defined(WZ_OS_MAC) programCommand = argv[0]; // Get full path to this program. Needed for gdb to find the binary. programIsAvailable = fetchProgramPath(programPath, sizeof(programPath), programCommand); // Get full path to 'gdb' gdbIsAvailable = fetchProgramPath(gdbPath, sizeof(gdbPath), "gdb"); sysInfoValid = (uname(&sysInfo) == 0); currentTime = time(NULL); sstrcpy(executionDate, ctime(¤tTime)); snprintf(programPID, sizeof(programPID), "%i", getpid()); setFatalSignalHandler(posixExceptionHandler);#endif // WZ_OS_*}
开发者ID:Safety0ff,项目名称:warzone2100,代码行数:41,
示例19: recvTextMessageAI//AI multiplayer message - received message from AI (from scripts)bool recvTextMessageAI(NETQUEUE queue){ UDWORD sender, receiver; char msg[MAX_CONSOLE_STRING_LENGTH]; char newmsg[MAX_CONSOLE_STRING_LENGTH]; NETbeginDecode(queue, NET_AITEXTMSG); NETuint32_t(&sender); //in-game player index ('normal' one) NETuint32_t(&receiver); //in-game player index NETstring(newmsg,MAX_CONSOLE_STRING_LENGTH); NETend(); if (whosResponsible(sender) != queue.index) { sender = queue.index; // Fix corrupted sender. } //sstrcpy(msg, getPlayerName(sender)); // name //sstrcat(msg, " : "); // seperator sstrcpy(msg, newmsg); triggerEventChat(sender, receiver, newmsg); //Display the message and make the script callback displayAIMessage(msg, sender, receiver); //Received a console message from a player callback //store and call later //------------------------------------------------- if(!msgStackPush(CALL_AI_MSG,sender,receiver,msg,-1,-1,NULL)) { debug(LOG_ERROR, "recvTextMessageAI() - msgStackPush - stack failed"); return false; } return true;}
开发者ID:mikevdg,项目名称:warzone2100-pathing,代码行数:37,
示例20: SetWinTitleVOID SetWinTitle(HWND hwnd, PATTMAN pam) { CHAR buf[LPATH + 32]; dprintf("Settaggio titolo finestra/n"); DlgLboxQueryItemText(hwnd, LB_FILE, pam->fsp.psSel[1], buf, LPATH + 32); // se C++ sstrdup函数代码示例 C++ sstrcat函数代码示例
|