这篇教程C++ stringdup函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stringdup函数的典型用法代码示例。如果您正苦于以下问题:C++ stringdup函数的具体用法?C++ stringdup怎么用?C++ stringdup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stringdup函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: close_fileint WavefrontDisplayDevice::open_file(const char *filename) { if (isOpened) { close_file(); } if ((outfile = fopen(filename, "w")) == NULL) { msgErr << "Could not open file " << filename << " in current directory for writing!" << sendmsg; return FALSE; } my_filename = stringdup(filename);#ifdef VMDGENMTLFILE mtlfilename = stringdup(filename); if (replacefileextension(mtlfilename, ".obj", ".mtl")) { msgErr << "Could not generate material filename" << sendmsg; return FALSE; } if ((mtlfile = fopen(mtlfilename, "w")) == NULL) { msgErr << "Could not open file " << mtlfilename << " in current directory for writing!" << sendmsg; return FALSE; }#endif isOpened = TRUE; reset_state(); oldColorIndex = -1; oldMaterialIndex = -1; oldMaterialState = -1; return TRUE;}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:31,
示例2: ifWhereClause::WhereClause(const char* p, const char* v, WhereClauseOperator o, bool s) { type = WHERE_CLAUSE; property = NULL; if (p) property = stringdup(p); value = NULL; if (v) value = stringdup(v); op = o; caseSensitive = s;}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:7,
示例3: CommandCmdMaterialAdd::CmdMaterialAdd(const char *s, const char *copyfrom): Command(MATERIAL_ADD) { name = copy = NULL; if (s) name = stringdup(s); if (copyfrom) copy = stringdup(copyfrom);}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:8,
示例4: BaseEventUSE_NAMESPACESyncSourceEvent::SyncSourceEvent(const char* uri, const char* sourcename, int mode, int data, int type, unsigned long date) : BaseEvent(type, date) { sourceURI = stringdup(uri); syncMode = mode; name = stringdup(sourcename); this->data = data;}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:9,
示例5: memsetstruct syntaxnode *allocnode(enum syntaxtype type, int subtype, struct token *token){ struct syntaxnode *node; node = (struct syntaxnode *)xmalloc(sizeof(*node)); memset(node, 0x0, sizeof(*node)); node->type = type; node->datatype = dtvoid; node->lineno = token->lineno; if (type == syntaxstmt) { node->subtype.stmt = subtype; switch (subtype) { case stmtif: case stmtrepeat: node->attr.tktype = token->type; break; case stmtassign: case stmtread: node->attr.name = stringdup(token->buf); break; case stmtwrite: /* write needs nothing */ break; default: /* should this happen? */ node->subtype.stmt = stmtunknown; break; } } else if (type == syntaxexp) { node->subtype.exp = subtype; switch (subtype) { case expop: node->attr.tktype = token->type; break; case expconst: node->attr.val = atoi(token->buf); break; case expid: node->attr.name = stringdup(token->buf); break; default: /* should this happen? */ node->subtype.exp = expunknown; break; } } else { /* stmtunknown == expunknown */ node->subtype.stmt = stmtunknown; printf("unknown node/n"); } return node;}
开发者ID:doniexun,项目名称:private_compiler,代码行数:53,
示例6: DrawMoleculeMolecule::Molecule(const char *src, VMDApp *vmdapp, Displayable *d) : DrawMolecule(vmdapp, d), coorIOFiles(8) { char *strPath = NULL, *strName = NULL; breakup_filename(src, &strPath, &strName); if (!strName) strName = stringdup("unknown"); // set the molecule name moleculename = stringdup(strName); delete [] strPath; delete [] strName;}
开发者ID:VictorMion,项目名称:vmd-cvs-github,代码行数:12,
示例7: stringdupUSE_NAMESPACE/* * Constructor. * * @param parent - a ManagementNode is usually under the context of a * parent node. * @param name - the node name * */ManagementNode::ManagementNode(const char* parent, const char* name) { context = stringdup(parent); this->name = stringdup(name);}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:15,
示例8: stringdup/** * Sets the reference value. If value is null, the empty string is adopted. * * @param value the reference value - NULL */void SourceRef::setValue(const char* value) { if (this->value) { delete [] this->value; this->value = NULL; } this->value = stringdup(value);}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:12,
示例9: strrchrint ManagementNode::setFullName(const char *fullname) { char* p; int len; p = strrchr((char*)fullname, '/'); if ( !p ) return -1; len = p-fullname; context = stringdup(fullname, len); p++; len=strlen(fullname)-len; name = stringdup(p, len); return 0;}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:16,
示例10: safeDeletevoid SyncSourceConfig::setEncoding(const char* s) { safeDelete(&encodings); if (s) { encodings = stringdup(s); }}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:7,
示例11: stringdup/** * Creates a new CmdID object with the given String cmdID * * @param cmdID the cmdID of CmdID - NOT NULL * */CmdID::CmdID(const char* cmdID) { this->cmdID = NULL; if ((cmdID == NULL) || (strlen(cmdID) == 0)) { // tbd } this->cmdID = stringdup(cmdID);}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:14,
示例12: stringdup/** * Sets type * * @param type the new type value */void SourceFilter::setType(const char*type) { delete [] this->type; if (type) { this->type = stringdup(type); } else { this->type = NULL; }}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:14,
示例13: stringdup/* * Sets displayName * * @param displayName the new value * */void PropParam::setDisplayName(const char*displayName) { if (this->displayName) { delete [] this->displayName; this->displayName = NULL; } if (displayName) { this->displayName = stringdup(displayName); }}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:15,
示例14: stringdup/* * Sets value * * @param value the new value * */void WhereClause::setValue(const char*value) { if (this->value) { delete this->value; this->value = NULL; } if (value) { this->value = stringdup(value); }}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:15,
示例15: setLocURIvoid Source::set(const char* locURI, const char* locName) { setLocURI(locURI); if (this->locName) { delete [] this->locName; this->locName = NULL; } this->locName = stringdup(locName);}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:9,
示例16: type/** @brief Set values for the object @param sync_type Sync type (values: 6-10) @param content_type MIME type @param len Server URI lenght @param buf Server URI characters @return */int SyncAlert::set(int sync_type, int content_type, const char *uri){ if (sync_type < 6 || sync_type > 10) return -1; syncType = sync_type+200; contentType = content_type; serverURI=stringdup(uri); return 0;}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:19,
示例17: stringdup/** * Sets the source URI * * @param locURI the source URI - NOT NULL * */void Source::setLocURI(const char* locURI) { if (locURI == NULL) { // TBD } if (this->locURI) { delete [] this->locURI; this->locURI = NULL; } this->locURI = stringdup(locURI);}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:15,
示例18: stringdup/*** Sets the cmd element** @param cmd the new cmd element - NOT NULL**/void Status::setCmd(const char* cmd) { if (cmd == NULL) { // TBD } else { if (this->cmd) { delete [] this->cmd; this->cmd = NULL; } this->cmd = stringdup(cmd); }}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:16,
示例19: stringdup/** * The result must be deleted by caller */const char* MailMessage::getHeaders(){ if( headers.size() ) { StringBuffer buff; buff.join(headers, "/n"); char* strHeaders = stringdup(buff.c_str(), buff.length() -1); return strHeaders; } else return 0;}
开发者ID:ruphy,项目名称:kfunambol,代码行数:13,
示例20: VMDMenuVMDFltkMenu::VMDFltkMenu(const char *menuname,const char *title,VMDApp *vmdapp) : VMDMenu(menuname, vmdapp), Fl_Window(0,0,NULL) { _title=stringdup(title); Fl_Window::label(_title);#if defined(VMDMENU_WINDOW) Fl_Window::color(VMDMENU_WINDOW);#endif callback(window_cb);}
开发者ID:gzoppetti,项目名称:ExscitechVmd,代码行数:10,
示例21: strtoupperchar* strtoupper(const char *s){ char* u = NULL; char* p = NULL; for(u = p = stringdup(s); *p; ++p) { *p=toupper(*p); } return u;}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:10,
示例22: strtolowerchar* strtolower(const char *s){ char* l = NULL; char* p = NULL; for(l = p = stringdup(s); *p; ++p) { *p=tolower(*p); } return l;}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:10,
示例23: while/* * Returns the value of the given property * the value is returned as a new char array and must be fred by the user * * @param property - the property name */char* DeviceManagementNode::readPropertyValue(const char* property) { int i = 0; while (true) { line *curr = (line *)lines->get(i); if (!curr) { break; } const char *value = curr->getLine(); while (*value && isspace(*value)) { value++; } if (!strnicmp(value, property, strlen(property))) { value = strchr(value, '='); if (value) { value++; while (*value && isspace(*value)) { value++; } char *res = stringdup(value); // FOUND :) // remove trailing white space: usually it is // added accidentally by users char *tmp = res + strlen(res) - 1; while (tmp > res) { if (!isspace(*tmp)) { break; } tmp--; } tmp[1] = 0; return res; } } i++; } // Not found, return an empty string return stringdup("");}
开发者ID:pohly,项目名称:funambol-cpp-client-api,代码行数:47,
示例24: stringdup/* * Returns the SyncHeader/RespURI element of the given message. If the element is not * found it returns NULL. The returned respURI is allocated with the new operator * and must be discarded with delete by the caller. * * @param SyncHdr - the SyncHdr object - NOT NULL */const char* SyncMLProcessor::getRespURI(SyncHdr* syncHdr) { char* respURI = NULL; if (syncHdr == NULL) { goto finally; } respURI = stringdup(syncHdr->getRespURI());finally: return respURI;}
开发者ID:ruphy,项目名称:kfunambol,代码行数:20,
示例25: stringdupchar* FolderData::format() { StringBuffer out; out.reserve(150); out = "<Folder>/n"; if (name.length() > 0) out += XMLProcessor::makeElement(FOLDER_NAME, name); if (created.length() > 0) out += XMLProcessor::makeElement(FOLDER_CREATED, created); if (modified.length() > 0) out += XMLProcessor::makeElement(FOLDER_MODIFIED, modified); if (accessed.length() > 0) out += XMLProcessor::makeElement(FOLDER_ACCESSED, accessed); StringBuffer attributes; if (isHiddenPresent) attributes += XMLProcessor::makeElement(FOLDER_HIDDEN, hidden); if (isSystemPresent) attributes += XMLProcessor::makeElement(FOLDER_SYSTEM, system); if (isArchivedPresent) attributes += XMLProcessor::makeElement(FOLDER_ARCHIVED, archived); if (isDeletedPresent) attributes += XMLProcessor::makeElement(FOLDER_DELETE, deleted); if (isWritablePresent) attributes += XMLProcessor::makeElement(FOLDER_WRITABLE, writable); if (isReadablePresent) attributes += XMLProcessor::makeElement(FOLDER_READABLE, readable); if (isExecutablePresent) attributes += XMLProcessor::makeElement(FOLDER_EXECUTABLE, executable); if (!attributes.empty()) out += XMLProcessor::makeElement(FOLDER_ATTRIBUTES, attributes); if (role.length() > 0) out += XMLProcessor::makeElement(FOLDER_ROLE, role); if (!(extended.isEmpty())){ for(int i=0; i < extended.size(); i++){ const char* temp = ((FolderExt*)extended.get(i))->format(); out += temp; delete [] temp; } } out += "</Folder>/n"; return stringdup(out.c_str());}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:50,
示例26: sint MoleculeGraphics::add_text(const float *x, const char *text, float size, float thickness) { ShapeClass s(TEXT, 6, next_id); float *data = s.data; vec_copy(data+0, x); data[3] = size; data[4] = thickness; data[5] = (float)shapetext.num(); // index where the text will be stored shapetext.append(stringdup(text)); if (next_index < num_elements()) shapes[next_index] = s; else shapes.append(s); return added();}
开发者ID:tmd-gpat,项目名称:MOLding,代码行数:15,
示例27: MD5CredentialDatachar* MD5CredentialData(const char* userName, const char* password, const char* nonce) { int len = 0, lenNonce = 0, totLen = 0; char cnonce [64]; char digest [16]; char base64 [64]; char base64Nonce [64]; char token [512]; char* md5Digest = NULL; char ch [3]; memset(digest, 0, 16); memset(base64, 0, 64); memset(base64Nonce, 0, 64); memset(cnonce, 0, 64); memset(token, 0, 512); sprintf(ch, ":"); sprintf(token, "%s:%s", userName, password); len = strlen(token); // H(username:password) calculateMD5((void*)token, len, digest); // B64(H(username:password)) len = b64_encode((char*)base64, digest, 16); // decode nonce from stored base64 to bin strcpy(cnonce, nonce); lenNonce = b64_decode(cnonce, cnonce); memcpy(base64Nonce, base64, len); memcpy(&base64Nonce[len], ch, 1); memcpy(&base64Nonce[len+1], cnonce, lenNonce); totLen = len + 1 + lenNonce; memset(digest, 0, 16); calculateMD5(base64Nonce, totLen, digest); b64_encode(base64, digest, 16); // return new value md5Digest = stringdup(base64); return md5Digest;}
开发者ID:fieldwind,项目名称:syncsdk,代码行数:47,
注:本文中的stringdup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stringf函数代码示例 C++ string_vsnprintf函数代码示例 |