当前位置: 首页>>代码示例>>C++>>正文


C++ string::length方法代码示例

本文整理汇总了C++中std::string::length方法的典型用法代码示例。如果您正苦于以下问题:C++ string::length方法的具体用法?C++ string::length怎么用?C++ string::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在std::string的用法示例。


在下文中一共展示了string::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getSystemVar

ValueType getSystemVar(const EERIE_SCRIPT * es, Entity * entity, const std::string & name,
                       std::string& txtcontent, float * fcontent,long * lcontent) {
	
	arx_assert(!name.empty() && name[0] == '^', "bad system variable: \"%s\"", name.c_str());
	
	char c = (name.length() < 2) ? '\0' : name[1];
	switch(c) {
		
		case '$': {
			
			if(name == "^$param1") {
				txtcontent = SSEPARAMS[0];
				return TYPE_TEXT;
			}
			
			if(name == "^$param2") {
				txtcontent = SSEPARAMS[1];
				return TYPE_TEXT;
			}
			
			if(name == "^$param3") {
				txtcontent = SSEPARAMS[2];
				return TYPE_TEXT;
			}
			
			if(name == "^$objontop") {
				txtcontent = "none";
				if(entity) {
					MakeTopObjString(entity, txtcontent);
				}
				return TYPE_TEXT;
			}
			
			break;
		}
		
		case '&': {
			
			if(name == "^&param1") {
				*fcontent = (float)atof(SSEPARAMS[0]);
				return TYPE_FLOAT;
			}
			
			if(name == "^&param2") {
				*fcontent = (float)atof(SSEPARAMS[1]);
				return TYPE_FLOAT;
			}
			
			if(name == "^&param3") {
				*fcontent = (float)atof(SSEPARAMS[2]);
				return TYPE_FLOAT;
			}
			
			if(name == "^&playerdist") {
				if(entity) {
					*fcontent = fdist(player.pos, entity->pos);
					return TYPE_FLOAT;
				}
			}
			
			break;
		}
		
		case '#': {
			
			if(name == "^#playerdist") {
				if(entity) {
					*lcontent = (long)fdist(player.pos, entity->pos);
					return TYPE_LONG;
				}
			}
			
			if(name == "^#param1") {
				*lcontent = atol(SSEPARAMS[0]);
				return TYPE_LONG;
			}
			
			if(name == "^#param2") {
				*lcontent = atol(SSEPARAMS[1]);
				return TYPE_LONG;
			}
			
			if(name == "^#param3") {
				*lcontent = atol(SSEPARAMS[2]);
				return TYPE_LONG;
			}
			
			if(name == "^#timer1") {
				if(!entity || entity->script.timers[0] == 0) {
					*lcontent = 0;
				} else {
					*lcontent = long((unsigned long)(arxtime) - es->timers[0]);
				}
				return TYPE_LONG;
			}
			
			if(name == "^#timer2") {
				if(!entity || entity->script.timers[1] == 0) {
					*lcontent = 0;
				} else {
//.........这里部分代码省略.........
开发者ID:hulu1528,项目名称:ArxLibertatis,代码行数:101,代码来源:Script.cpp

示例2: converteStringParaMinuscula

void CDC::converteStringParaMinuscula(std::string &str) {
    for(unsigned int pos=0; pos<str.length(); pos++) {
        if(str[pos]>=65 && str[pos]<=90) str[pos]+=32;
    }
}
开发者ID:adyjunior,项目名称:adyjrpucgo,代码行数:5,代码来源:CDC.cpp

示例3: convertToUtcTimeT

bool TimeUtils::convert8601TimeStringToUnix(const std::string& timeString, int64_t* convertedTime) {
    // TODO : Use std::get_time once we only support compilers that implement this function (GCC 5.1+ / Clang 3.3+)

    if (!convertedTime) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("convertedTime parameter was nullptr."));
        return false;
    }

    std::tm timeInfo;

    if (timeString.length() != ENCODED_TIME_STRING_EXPECTED_LENGTH) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").d("unexpected time string length:", timeString.length()));
        return false;
    }

    if (!stringToInt(
            timeString.substr(ENCODED_TIME_STRING_YEAR_OFFSET, ENCODED_TIME_STRING_YEAR_STRING_LENGTH),
            &(timeInfo.tm_year))) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("error parsing year. Input:" + timeString));
        return false;
    }

    if (!stringToInt(
            timeString.substr(ENCODED_TIME_STRING_MONTH_OFFSET, ENCODED_TIME_STRING_MONTH_STRING_LENGTH),
            &(timeInfo.tm_mon))) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("error parsing month. Input:" + timeString));
        return false;
    }

    if (!stringToInt(
            timeString.substr(ENCODED_TIME_STRING_DAY_OFFSET, ENCODED_TIME_STRING_DAY_STRING_LENGTH),
            &(timeInfo.tm_mday))) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("error parsing day. Input:" + timeString));
        return false;
    }

    if (!stringToInt(
            timeString.substr(ENCODED_TIME_STRING_HOUR_OFFSET, ENCODED_TIME_STRING_HOUR_STRING_LENGTH),
            &(timeInfo.tm_hour))) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("error parsing hour. Input:" + timeString));
        return false;
    }

    if (!stringToInt(
            timeString.substr(ENCODED_TIME_STRING_MINUTE_OFFSET, ENCODED_TIME_STRING_MINUTE_STRING_LENGTH),
            &(timeInfo.tm_min))) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("error parsing minute. Input:" + timeString));
        return false;
    }

    if (!stringToInt(
            timeString.substr(ENCODED_TIME_STRING_SECOND_OFFSET, ENCODED_TIME_STRING_SECOND_STRING_LENGTH),
            &(timeInfo.tm_sec))) {
        ACSDK_ERROR(LX("convert8601TimeStringToUnixFailed").m("error parsing second. Input:" + timeString));
        return false;
    }

    // adjust for C struct tm standard
    timeInfo.tm_isdst = 0;
    timeInfo.tm_year -= 1900;
    timeInfo.tm_mon -= 1;

    std::time_t convertedTimeT;
    bool ok = convertToUtcTimeT(&timeInfo, &convertedTimeT);

    if (!ok) {
        return false;
    }

    *convertedTime = static_cast<int64_t>(convertedTimeT);
    return true;
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:72,代码来源:TimeUtils.cpp

示例4: Load

bool cTIFFFile::Load(GLCD::cImage & image, const std::string & fileName)
{
    FILE         *fIN;
    TIFFTAG       tifftag;
    unsigned int  tiff_header, tiff_anztags, tiff_data;
    unsigned char cl,ch,y,i;
    unsigned char height, width, strip, invert;
    unsigned char fLittleEndian=0;
    int j;
    int t;
    unsigned char *bitmap = NULL;
    bool  bInvert = false;

    if (fileName.length() > 0)
    {
        fIN = fopen(fileName.c_str(), "rb");
        if (fIN)
        {
            //    isyslog("graphlcd plugin: try to load logo %s.", szFileName);
            if (fseek(fIN, 0, SEEK_SET)==EOF)
            {
                fclose(fIN);
                return false;
            }
            GETANDCHECK; cl=(unsigned char)t;
            GETANDCHECK; ch=(unsigned char)t;
            if ((cl==0x49) && (ch==0x49))
            {
                fLittleEndian=1;
            }

            if (fseek(fIN, 4, SEEK_SET)==EOF)
            {
                fclose(fIN);
                return false;
            }
            GETANDCHECK; cl=(unsigned char)t;
            GETANDCHECK; ch=(unsigned char)t;
            tiff_header = cl+256*ch;
            //printf("tiff_header:%d %x\n", tiff_header, tiff_header);

            if (fseek(fIN, tiff_header, SEEK_SET)==EOF)
            {
                fclose(fIN);
                return false;
            }

            GETANDCHECK; cl=(unsigned char)t;
            GETANDCHECK; ch=(unsigned char)t;
            tiff_anztags = cl+256*ch;
            //printf("tiff_anztags:%d %x\n", tiff_anztags, tiff_anztags);

            height=0;
            width=0;
            strip=0;
            invert=0;
            for (i=0; (i<tiff_anztags)&&(!height||!width||!strip||!invert); i++)
            {
                if (fread(&tifftag, sizeof(tifftag), 1, fIN)!=1)
                {
                    fclose(fIN);
                    return false;
                }
                if (tifftag.tag==0x0100) width=tifftag.off_val;
                if (tifftag.tag==0x0101) height=tifftag.off_val;
                if (tifftag.tag==0x0111) strip=tifftag.off_val;
                if (tifftag.tag==0x0106) invert=tifftag.off_val+1;
                //printf("tag%d: %d %d %ld %ld\n", i,tifftag.tag, tifftag.type, tifftag.length, tifftag.off_val );
            }

            if (fseek(fIN,strip, SEEK_SET)==EOF)
            {
                fclose(fIN);
                return false;
            }
            GETANDCHECK; cl=(unsigned char)t;
            GETANDCHECK; ch=(unsigned char)t;
            tiff_data = cl+256*ch;
            //printf("tiff_data:%d %x\n", tiff_data, tiff_data);

            if (fseek(fIN, tiff_data, SEEK_SET)==EOF)
            {
                fclose(fIN);
                return false;
            }


            image.Clear();
            image.SetWidth(width);
            image.SetHeight(height);
            image.SetDelay(100);
            bitmap = new unsigned char[height * ((width + 7) / 8)];
            if (bitmap)
            {
                if (fread(bitmap, height*((width+7)/8), 1, fIN)!=1)
                {
                    delete [] bitmap;
                    fclose(fIN);
                    image.Clear();
                    return false;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:graphlcd-svn,代码行数:101,代码来源:tiff.c

示例5: net_process

void RPCClient::net_process(const std::function<void(std::string)>& disconnect) {
	connected = true;

	uint8_t count = 0;
	while (true) {
		int content_length = -2;
		bool close_after_read = false;
		int max_read;
		char buf[2048];
		std::string line;

		while (true) {
			std::string::size_type line_break;
			while ((line_break = line.find("\r\n")) == std::string::npos) {
				if (line.find("\r") != std::string::npos)
					max_read = 1;
				else
					max_read = 2;

				if (read_all(buf, max_read, std::chrono::seconds(10)) != max_read)
					return disconnect("Failed to read server response");
				line.append(buf, buf + max_read);

				if (line.length() > 16384)
					return disconnect("Got header longer than 16k!");
			}

			std::string current_line(line.substr(0, line_break));
			line = line.substr(line_break + 2);

			if (content_length == -2) {
				if (current_line != std::string("HTTP/1.1 200 OK"))
					return disconnect("Got HTTP error message: " + asciifyString(current_line));
				content_length++;
			} else if (current_line.length()) {
				std::string::size_type colon(current_line.find(':'));
				if (colon == std::string::npos)
					return disconnect("Got Bad HTTP header line: " + asciifyString(current_line));
				if (current_line.compare(0, strlen("Connection: "), "Connection: ") == 0) {
					if (current_line.compare(strlen("Connection: "), strlen("close"), "close") == 0)
						close_after_read = true;
					else if (current_line.compare(strlen("Connection: "), strlen("keep-alive"), "keep-alive") != 0)
						return disconnect("Got Bad HTTP Connection header line: " + asciifyString(current_line));
				} else if (current_line.compare(0, strlen("Content-Length: "), "Content-Length: ") == 0) {
					try {
						size_t endpos;
						content_length = std::stoi(&(current_line.c_str())[strlen("Content-Length: ")], &endpos);
						if (content_length < 0 || endpos != current_line.length() - strlen("Content-Length: "))
							return disconnect("Got Bad HTTP Content-Length header line: " + asciifyString(current_line));
					} catch (std::exception& e) {
						return disconnect("Got Bad HTTP Content-Length header line: " + asciifyString(current_line));
					}
				}
			} else if (content_length < 0)
				return disconnect("Got to end of HTTP headers without a Content-Length");
			else
				break;
		}

		if (content_length < 0 || content_length > 1024*1024*100)
			return disconnect("Got unreasonably large response size");

		//Dumb JSON parser that mostly assumes valid (minimal-size) JSON...
		static const std::string expected_start("{\"result\":{");
		{
			char resp[expected_start.length()];
			if (read_all(resp, expected_start.length()) != (ssize_t)expected_start.length())
				return disconnect("Failed to read response");
			if (memcmp(resp, &expected_start[0], expected_start.length()) != 0)
				return disconnect("Got result which was not an object");
		}

		std::vector<unsigned char> resp(content_length - expected_start.length());
		if (read_all((char*)&resp[0], content_length - expected_start.length()) != content_length - (ssize_t)expected_start.length())
			return disconnect("Failed to read response");
		auto it = resp.begin();

		//These do not move
		std::list<CTxMemPoolEntry> txn;
		//These index into txn
		std::vector<CTxMemPoolEntry*> vectorToSort;
		std::unordered_map<std::string, CTxMemPoolEntry*> hashToEntry;
		std::unordered_multimap<std::string, CTxMemPoolEntry*> txnWaitingOnDeps;

		// These are values/flags about the current status of the parser
		int32_t stringStart = -1, fieldValueStart = -1;
		std::string txHash, fieldString;
		long tx_size = -1; uint64_t tx_fee = -1; double tx_prio = -1;
		bool inTx = false, inFieldString = false, inFieldValue = false;
		std::unordered_set<std::string> txDeps;

		static const std::string expected_end("},\"error\":null,\"id\":1}\n");
		while (it < resp.end() - expected_end.length()) {
			while ((*it == ' ') && it < resp.end() - 1) it++;
			switch(*it) {
			case '"':
				if (stringStart != -1) {
					if (!inTx)
						txHash = std::string(resp.begin() + stringStart, it);
					else if (inFieldString)
//.........这里部分代码省略.........
开发者ID:TheBlueMatt,项目名称:RelayNode,代码行数:101,代码来源:rpcclient.cpp

示例6: NetworkArg

 /** Convert regular argument into the network-specific setting */
 static inline std::string NetworkArg(const ArgsManager& am, const std::string& arg)
 {
     assert(arg.length() > 1 && arg[0] == '-');
     return "-" + am.m_network + "." + arg.substr(1);
 }
开发者ID:alanxu89,项目名称:bitcoin,代码行数:6,代码来源:util.cpp

示例7: talk

    }
    BLOCK_END("ChatHandler::handleMessage")
}

void ChatHandler::talk(const std::string &restrict text,
                       const std::string &restrict channel A_UNUSED) const
{
    if (!localPlayer)
        return;

    const std::string mes = std::string(localPlayer->getName()).append(
        " : ").append(text);

    createOutPacket(CMSG_CHAT_MESSAGE);
    // Added + 1 in order to let eAthena parse admin commands correctly
    outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4 + 1), "len");
    outMsg.writeString(mes, static_cast<int>(mes.length() + 1), "message");
}

void ChatHandler::talkRaw(const std::string &mes) const
{
    createOutPacket(CMSG_CHAT_MESSAGE);
    outMsg.writeInt16(static_cast<int16_t>(mes.length() + 4), "len");
    outMsg.writeString(mes, static_cast<int>(mes.length()), "message");
}

void ChatHandler::privateMessage(const std::string &restrict recipient,
                                 const std::string &restrict text)
{
    createOutPacket(CMSG_CHAT_WHISPER);
    outMsg.writeInt16(static_cast<int16_t>(text.length() + 28), "len");
开发者ID:yahersfa,项目名称:ManaPlus,代码行数:31,代码来源:chathandler.cpp

示例8: return

int64_t rsg::RsgCommHandler::send_async(const int64_t sender, const int64_t dest, const std::string& data, const int64_t size, const int64_t simulatedByteAmount) {
    s4u::MailboxPtr mbox = rsg::RsgMailboxHandler::pMailboxes.at(dest);
    std::string *strData = new std::string(data.data(), data.length());
    return (int64_t) &s4u::Comm::send_async(mbox, (void*) strData, simulatedByteAmount);
}
开发者ID:adfaure,项目名称:remote-simgrid,代码行数:5,代码来源:commService.cpp

示例9: sizeof

void rsg::RsgCommHandler::setSrcData(const int64_t addr, const std::string& buff) {
    s4u::Comm *comm = (s4u::Comm*) addr;
    std::string *payload = new std::string(buff.data(), buff.length());
    comm->setSrcData((void*)payload, sizeof(void*));
}
开发者ID:adfaure,项目名称:remote-simgrid,代码行数:5,代码来源:commService.cpp

示例10: removeCharFromOrder

void NCursesIOManager::removeCharFromOrder(std::string & input)
{
	input.resize(input.length() == 0 ? 0 : input.length() - 1);
}
开发者ID:kiuKisas,项目名称:Plazza,代码行数:4,代码来源:NCursesIOManager.cpp

示例11: istarts_with

bool StringUtils::istarts_with(const std::string &string, const std::string &prefix)
{
    return starts_with_internal(string.c_str(), string.size(),
                                prefix.c_str(), prefix.length(),
                                true);
}
开发者ID:DreamStar001,项目名称:DualBootPatcher,代码行数:6,代码来源:stringutils.cpp

示例12: writeOutput

void writeOutput(const std::string& filename, const std::string& output)
{
	std::ofstream file(filename.c_str(), std::ios::binary);

	file.write(output.c_str(), output.length());
}
开发者ID:GotoHack,项目名称:IDA-Pro-plugins,代码行数:6,代码来源:helpers.cpp

示例13: RemoveApostrophes

void RemoveApostrophes(std::string &s)
{
	for(unsigned int i = 0; i < s.length(); ++i)
		if(s[i] == '\'')
			 s[i] = '_';
}
开发者ID:Siroro,项目名称:Server,代码行数:6,代码来源:StringUtil.cpp

示例14: readRawFile

                //=================================================================
                bool TileAssembler::readRawFile(std::string& pModelFilename,  ModelPosition& pModelPosition, AABSPTree<SubModel *> *pMainTree)
                {
                    bool result = false;

                    std::string filename = iSrcDir;
                    if(filename.length() >0)
                        filename.append("/");
                    filename.append(pModelFilename);
                    FILE *rf = fopen(filename.c_str(), "rb");
                    if(!rf)
                    {
                        // depending on the extractor version, the data could be located in the root dir
                        std::string baseModelFilename = pModelFilename.substr((pModelFilename.find_first_of("/")+1),pModelFilename.length());
                        filename = iSrcDir;
                        if(filename.length() >0)
                            filename.append("/");
                        filename.append(baseModelFilename);
                        rf = fopen(filename.c_str(), "rb");
                    }
                    char ident[8];

                    int trianglecount =0;

                    #ifdef _ASSEMBLER_DEBUG
                    int startgroup = 0;                     //2;
                    int endgroup = INT_MAX;                 //2;
                    fprintf(::g_df,"-------------------------------------------------\n");
                    fprintf(::g_df,"%s\n", pModelFilename.c_str());
                    fprintf(::g_df,"-------------------------------------------------\n");
                    #else
                    int startgroup = 0;
                    int endgroup = INT_MAX;
                    #endif

                    if(rf)
                    {
                        if(fread(&ident, 8, 1, rf) != 1) { fclose(rf); return(false); }
                        if(strcmp(ident, "VMAP001") == 0)
                        {
                            // OK, do nothing
                        }
                        else if(strcmp(ident, "VMAP002") == 0)
                        {
                            // we have to read one int. This is needed during the export and we have to skip it here
                            int tempNVectors;
                            if(fread(&tempNVectors, sizeof(int), 1, rf) != 1) { fclose(rf); return(false); }

                        }
                        else
                        {
                            // wrong version
                            fclose(rf);
                            return(false);
                        }
                        unsigned int groups;
                        char blockId[5];
                        blockId[4] = 0;
                        int blocksize;

                        if(fread(&groups, sizeof(unsigned int), 1, rf) != 1) { fclose(rf); return(false); }

                        for(int g=0;g<(int)groups;g++)
                        {
                            // group MUST NOT have more then 65536 indexes !! Array will have a problem with that !! (strange ...)
                            Array<int> tempIndexArray;
                            Array<Vector3> tempVertexArray;

                            AABSPTree<Triangle> *gtree = new AABSPTree<Triangle>();

                            unsigned int flags;
                            if(fread(&flags, sizeof(unsigned int), 1, rf) != 1) { fclose(rf); return(false); }

                            unsigned int branches;
                            if(fread(&blockId, 4, 1, rf) != 1) { fclose(rf); return(false); }
                            if(strcmp(blockId, "GRP ") != 0) { fclose(rf); return(false); }
                            if(fread(&blocksize, sizeof(int), 1, rf) != 1) { fclose(rf); return(false); }
                            if(fread(&branches, sizeof(unsigned int), 1, rf) != 1) { fclose(rf); return(false); }
                            for(int b=0;b<(int)branches; b++)
                            {
                                unsigned int indexes;
                                // indexes for each branch (not used jet)
                                if(fread(&indexes, sizeof(unsigned int), 1, rf) != 1) { fclose(rf); return(false); }
                            }

                            // ---- indexes
                            if(fread(&blockId, 4, 1, rf) != 1) { fclose(rf); return(false); }
                            if(strcmp(blockId, "INDX") != 0) { fclose(rf); return(false); }
                            if(fread(&blocksize, sizeof(int), 1, rf) != 1) { fclose(rf); return(false); }
                            unsigned int nindexes;
                            if(fread(&nindexes, sizeof(unsigned int), 1, rf) != 1) { fclose(rf); return(false); }
                            if(nindexes >0)
                            {
                                unsigned short *indexarray = new unsigned short[nindexes*sizeof(unsigned short)];
                                if(fread(indexarray, sizeof(unsigned short), nindexes, rf) != nindexes) { fclose(rf); return(false); }
                                for(int i=0;i<(int)nindexes; i++)
                                {
                                    unsigned short val = indexarray[i];
                                    tempIndexArray.append(val);
                                }
//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:Summit,代码行数:101,代码来源:TileAssembler.cpp

示例15: CheckIWAD

//
// CheckIWAD
//
// Tries to find an IWAD from a set of know IWAD names, and checks the first
// one found's contents to determine whether registered/commercial features
// should be executed (notably loading PWAD's).
//
static bool CheckIWAD (std::string suggestion, std::string &titlestring)
{
	static const char *doomwadnames[] =
	{
		"doom2f.wad",
		"doom2.wad",
		"plutonia.wad",
		"tnt.wad",
		"doomu.wad", // Hack from original Linux version. Not necessary, but I threw it in anyway.
		"doom.wad",
		"doom1.wad",
		"freedoom.wad",
		"freedm.wad",
		"chex.wad",		// [ML] 1/7/10: Hello Chex Quest!
		NULL
	};

	std::string iwad;
	std::string iwad_file;
	int i;

	if(suggestion.length())
	{
		std::string found = BaseFileSearch(suggestion, ".WAD");

		if(found.length())
			iwad = found;
		else
		{
			if(M_FileExists(suggestion.c_str()))
				iwad = suggestion;
		}
		/*	[ML] Removed 1/13/10: we can trust the user to provide an iwad
		if(iwad.length())
		{
			FILE *f;

			if ( (f = fopen (iwad.c_str(), "rb")) )
			{
				wadinfo_t header;
				fread (&header, sizeof(header), 1, f);
				header.identification = LONG(header.identification);
				if (header.identification != IWAD_ID)
				{
					if(header.identification == PWAD_ID)
					{
						Printf(PRINT_HIGH, "Suggested file is a PWAD, not an IWAD: %s \n", iwad.c_str());
					}
					else
					{
						Printf(PRINT_HIGH, "Suggested file is not an IWAD: %s \n", iwad.c_str());
					}
					iwad = "";
				}
				fclose(f);
			}
		}
		*/
	}

	if(!iwad.length())
	{
		// Search for a pre-defined IWAD from the list above
		for (i = 0; doomwadnames[i]; i++)
		{
			std::string found = BaseFileSearch(doomwadnames[i]);

			if(found.length())
			{
				iwad = found;
				break;
			}
		}
	}

	// Now scan the contents of the IWAD to determine which one it is
	if (iwad.length())
	{
#define NUM_CHECKLUMPS 9
		static const char checklumps[NUM_CHECKLUMPS][8] = {
			"E1M1", "E2M1", "E4M1", "MAP01",
			{ 'A','N','I','M','D','E','F','S'},
			"FINAL2", "REDTNT2", "CAMO1",
			{ 'E','X','T','E','N','D','E','D'}
		};
		int lumpsfound[NUM_CHECKLUMPS];
		wadinfo_t header;
		FILE *f;
		M_ExtractFileName(iwad,iwad_file);

		memset (lumpsfound, 0, sizeof(lumpsfound));
		if ( (f = fopen (iwad.c_str(), "rb")) )
		{
//.........这里部分代码省略.........
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:101,代码来源:d_main.cpp


注:本文中的std::string::length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。