本文整理汇总了C++中ds::String::left方法的典型用法代码示例。如果您正苦于以下问题:C++ String::left方法的具体用法?C++ String::left怎么用?C++ String::left使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ds::String
的用法示例。
在下文中一共展示了String::left方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GameServer_Init
void DS::GameServer_Init()
{
dirent** dirls;
int count = scandir(DS::Settings::AgePath(), &dirls, &sel_age, &alphasort);
if (count < 0) {
fprintf(stderr, "[Game] Error reading age descriptors: %s\n", strerror(errno));
} else if (count == 0) {
fprintf(stderr, "[Game] Warning: No age descriptors found!\n");
free(dirls);
} else {
for (int i=0; i<count; ++i) {
DS::String filename = DS::String::Format("%s/%s", DS::Settings::AgePath(), dirls[i]->d_name);
FILE* ageFile = fopen(filename.c_str(), "r");
if (ageFile) {
char magic[12];
fread(magic, 1, 12, ageFile);
if (memcmp(magic, "whatdoyousee", 12) == 0 || memcmp(magic, "notthedroids", 12) == 0
|| memcmp(magic, "BriceIsSmart", 12) == 0) {
fprintf(stderr, "[Game] Error: Please decrypt your .age files before using!\n");
break;
}
fseek(ageFile, 0, SEEK_SET);
DS::String ageName = dirls[i]->d_name;
ageName = ageName.left(ageName.find(".age"));
Game_AgeInfo age = age_parse(ageFile);
if (age.m_seqPrefix >= 0)
s_ages[ageName] = age;
fclose(ageFile);
}
free(dirls[i]);
}
free(dirls);
}
pthread_mutex_init(&s_gameHostMutex, 0);
}