本文整理汇总了C++中eos函数的典型用法代码示例。如果您正苦于以下问题:C++ eos函数的具体用法?C++ eos怎么用?C++ eos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eos函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: req_nextSection
/* NULL otherwise. */
const char* req_nextSection(REQ_FILE* rf)
{
int i;
if(rf->sect_end==-1) return NULL;
fseek(rf->fd, rf->sect_end, SEEK_SET);
rf->sect_end= -1;
req_readChar(rf);
if(current(rf)!='[') return NULL;
req_readChar(rf);
i= 0;
while(!eos(rf) && (current(rf)!=']') && (i<20)) {
rf->sect_name[i++]= current(rf);
req_readChar(rf);
}
rf->sect_name[i]='\0';
if(current(rf)!=']') return NULL;
req_skipLine(rf);
rf->sect_start= ftell(rf->fd)-1;
while(!eos(rf) && (current(rf)!='[')) req_skipLine(rf);
rf->sect_end= ftell(rf->fd)-1;
fseek(rf->fd, rf->sect_start, SEEK_SET);
req_readChar(rf);
req_skipComment(rf);
return rf->sect_name;
}
开发者ID:ukaea,项目名称:epics,代码行数:35,代码来源:req_file.c
示例2: welcome
/* show "welcome [back] to DynaHack" message at program startup */
static void welcome(
boolean new_game) /* false => restoring an old game */
{
char buf[BUFSZ];
boolean currentgend = Upolyd ? u.mfemale : flags.female;
/*
* The "welcome back" message always describes your innate form
* even when polymorphed or wearing a helm of opposite alignment.
* Alignment is shown unconditionally for new games; for restores
* it's only shown if it has changed from its original value.
* Sex is shown for new games except when it is redundant; for
* restores it's only shown if different from its original value.
*/
*buf = '\0';
if (new_game || u.ualignbase[A_ORIGINAL] != u.ualignbase[A_CURRENT])
sprintf(eos(buf), "%s", align_str(u.ualignbase[A_ORIGINAL]));
if (!urole.name.f &&
(new_game ? (urole.allow & ROLE_GENDMASK) == (ROLE_MALE|ROLE_FEMALE) :
currentgend != u.initgend))
sprintf(eos(buf), "%s", genders[currentgend].adj + 2);
pline(new_game ? "%s,%s,欢迎来到LoongHack! 你是%s%s%s。"
: "%s,%s,%s%s%s,欢迎回到LoongHack!",
Hello(NULL), plname, buf, urace.adj,
(currentgend && urole.name.f) ? urole.name.f : urole.name.m + 2);
if (*level->levname)
pline("You named this level: %s.", level->levname);
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:31,代码来源:allmain.c
示例3: topten_level_name
/* append the level name to outbuf */
void
topten_level_name(int dnum, int dlev, char *outbuf)
{
if (dnum == astral_level.dnum) {
const char *arg, *fmt = "on the Plane of %s";
switch (dlev) {
case -5:
fmt = "on the %s Plane";
arg = "Astral";
break;
case -4:
arg = "Water";
break;
case -3:
arg = "Fire";
break;
case -2:
arg = "Air";
break;
case -1:
arg = "Earth";
break;
default:
arg = "Void";
break;
}
sprintf(eos(outbuf), fmt, arg);
} else {
sprintf(eos(outbuf), "in %s", dungeons[dnum].dname);
if (dnum != knox_level.dnum)
sprintf(eos(outbuf), " on level %d", dlev);
}
}
开发者ID:clockfort,项目名称:bingehack4,代码行数:35,代码来源:topten.c
示例4: doset
int
doset()
{
char buf[BUFSZ];
pline("What options do you want to set? ");
getlin(buf);
if(!buf[0] || buf[0] == '\033') {
(void) strlcpy(buf,"HACKOPTIONS=", sizeof buf);
(void) strlcat(buf, flags.female ? "female," : "male,", sizeof buf);
if(flags.standout) (void) strlcat(buf,"standout,", sizeof buf);
if(flags.nonull) (void) strlcat(buf,"nonull,", sizeof buf);
if(flags.nonews) (void) strlcat(buf,"nonews,", sizeof buf);
if(flags.time) (void) strlcat(buf,"time,", sizeof buf);
if(flags.notombstone) (void) strlcat(buf,"notombstone,", sizeof buf);
if(flags.no_rest_on_space)
(void) strlcat(buf,"!rest_on_space,", sizeof buf);
if(flags.end_top != 5 || flags.end_around != 4 || flags.end_own){
(void) snprintf(eos(buf), buf + sizeof buf - eos(buf),
"endgame: %u topscores/%u around me",
flags.end_top, flags.end_around);
if(flags.end_own) (void) strlcat(buf, "/own scores", sizeof buf);
} else {
char *eop = eos(buf);
if(*--eop == ',') *eop = 0;
}
pline("%s", buf);
} else
parseoptions(buf, FALSE);
return(0);
}
开发者ID:radixo,项目名称:openbsd-src,代码行数:32,代码来源:hack.options.c
示例5: curChar
wchar_t curChar(bool allow_change = true){
if(eof())
return '\0';
if(eos() && allow_change){
pop();
return curChar();
}else if(eos())
return '\0';
return data.back()[positions.back()];
}
开发者ID:TakeOver,项目名称:yet-another-try-to-make-useless-programming-language,代码行数:10,代码来源:stream.hpp
示例6: sprintf
char *payload(char *cmd,int safer)
{
char *retstr;
char *tmp;
retstr=(char*)malloc(4096);
sprintf(retstr,".PS\n");
// %f is 8 bytes long the two values are \\
// needed. the value was just the first one \\
// that I had in there... it it ain't broke... \\
tmp=eos(retstr);
sprintf(tmp,"plot %5.20f \"%%n\"\n",safer,0xbffffa08);
tmp=eos(retstr);
sprintf(tmp,"sh X%sX\n",cmd);
tmp=eos(retstr);
sprintf(tmp,".PE\n");
tmp=eos(retstr);
sprintf(tmp,"This is the way we hack the printer,\n");
tmp=eos(retstr);
sprintf(tmp,"Hack the printer, hack the printer.\n");
tmp=eos(retstr);
sprintf(tmp,"This is the way we hack the printer,\n");
tmp=eos(retstr);
sprintf(tmp,"when they are running a vulnerable version\n");
tmp=eos(retstr);
sprintf(tmp,"of groff.\n");
tmp=eos(retstr);
return retstr;
}
开发者ID:AlexxNica,项目名称:exploit-database,代码行数:30,代码来源:21037.c
示例7: while
void BlockIterator::seek(int64_t seekTimeUs) {
mCluster = mSegment->GetCluster(seekTimeUs * 1000ll);
mBlockEntry = mCluster != NULL ? mCluster->GetFirst() : NULL;
while (!eos() && block()->GetTrackNumber() != mTrackNum) {
advance();
}
while (!eos() && !mBlockEntry->GetBlock()->IsKey()) {
advance();
}
}
开发者ID:ConicalRom,项目名称:platform_frameworks_base,代码行数:12,代码来源:MatroskaExtractor.cpp
示例8: return
char *nh_build_plselection_prompt(char *buf, int buflen, int rolenum, int racenum,
int gendnum, int alignnum)
{
const char *defprompt = "需要我帮你选一个角色吗?";
int num_post_attribs = 0;
char tmpbuf[BUFSZ];
if (buflen < QBUFSZ)
return (char *)defprompt;
strcpy(tmpbuf, "需要我选择");
if (racenum != ROLE_NONE || validrole(rolenum))
strcat(tmpbuf, "你的");
else {
strcat(tmpbuf, "一个");
}
/* <your> */
nh_root_plselection_prompt(eos(tmpbuf), buflen - strlen(tmpbuf),
rolenum, racenum, gendnum, alignnum);
sprintf(buf, "%s", s_suffix(tmpbuf));
/* buf should now be:
* < your lawful female gnomish cavewoman's> || <your lawful female gnome's>
* || <your lawful female character's>
*
* Now append the post attributes to it
*/
num_post_attribs = post_attribs;
if (post_attribs) {
if (pa[BP_RACE]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "种族");
}
if (pa[BP_ROLE]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "角色");
}
if (pa[BP_GEND]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "性别");
}
if (pa[BP_ALIGN]) {
promptsep(eos(buf), num_post_attribs);
strcat(buf, "阵营");
}
}
strcat(buf, "吗?");
return buf;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:51,代码来源:role.c
示例9: while
string_parse &string_parse::skipwhite()
{
while (!eos() && std::isspace(static_cast<int>(*pos++)))
;
--pos;
return *this;
}
开发者ID:nixz,项目名称:covise,代码行数:7,代码来源:string_parse.cpp
示例10: string
symbol::operator std::string() const{
if( eos() ){
return std::string("\\z");
}else if( bos() ){
return std::string("\\A");
}else if( _val < 30 || _val > 0x7f ){
std::stringstream result;
if( _val > 0xffff ){
result << "\\U";
result.width(6);
}else{
result << "\\u";
result.width(4);
}
result.fill('0');
result << std::right << std::hex << _val;
return result.str();
}else{
std::string result;
if( op() ){
result += "\\";
}
result += static_cast<char>(_val);
return result;
}
}
开发者ID:hannesg,项目名称:kraken,代码行数:26,代码来源:base.cpp
示例11: strdup
char *msgtype_to_string(const struct nh_msgtype_rules *mt)
{
unsigned int size;
int i;
char *buf, *bp, pattern[120];
if (!mt || mt->num_rules == 0) {
buf = strdup("");
return buf;
}
/* 120 char pattern + 1-digit number + () + "" + , + ; < 128 chars */
size = 128 * mt->num_rules;
buf = malloc(size);
if (!buf)
return NULL;
buf[0] = '\0';
for (i = 0; i < mt->num_rules; i++) {
strncpy(pattern, mt->rules[i].pattern, sizeof(pattern));
pattern[sizeof(pattern) - 1] = '\0';
/* replace '"' and '|' and ';' with '?' to simplify parsing */
for (bp = pattern; *bp; bp++) {
if (*bp == '"' || *bp == '|' || *bp == ';')
*bp = '?';
}
snprintf(eos(buf), 128, "(\"%s\"|%u);", pattern, mt->rules[i].action);
}
return buf;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:33,代码来源:options.c
示例12: winCodeList_initcode
/* init code in the code list window */
void winCodeList_initcode(FILE *input)
{
Ycodelist *c = y_code_new(input);
y_code_dump(c);
y_code_map(c);
Ycodelist *cur;
char buf[100];
int i;
GtkTreeIter iter;
for (cur = c; cur; cur = cur->next) {
memset(buf, 0, sizeof(buf));
sprintf(buf, "%08X", cur->code->addr);
gtk_list_store_append(winCodeList.lstCodeList, &iter);
gtk_list_store_set(winCodeList.lstCodeList, &iter,
0, buf,
1, "",
2, cur->code->comment,
3, cur->code->addr,
-1);
memset(buf, 0, sizeof(buf));
for (i = 0; i < cur->code->count; ++i)
sprintf(eos(buf), "%02X", cur->code->ins[i]);
gtk_list_store_set(winCodeList.lstCodeList, &iter,
4, buf, -1);
}
y_code_free(c);
rewind(input);
gtk_tree_view_set_model(winCodeList.tvwCodeList,
GTK_TREE_MODEL(winCodeList.lstCodeList));
}
开发者ID:16L,项目名称:power86,代码行数:31,代码来源:wincodelist.c
示例13: ScanPattern
static short
ScanPattern (char *s, short *pindex)
{
small_short side, piece, square;
skipbb(&s); /* skip blanks and comments */
while (is_digit(*s))
{
pattern_data[(*pindex)++] = atoi(s);
skipi(&s);
}
pattern_data[(*pindex)++] = END_OF_LINKS;
skipbb(&s);
while (!eos(s))
{
if (ScanPiece(&s, &side, &piece, &square))
{
return 1;
}
else
{
pattern_data[(*pindex)++] = piece;
pattern_data[(*pindex)++] = (side ? -square : square);
}
}
pattern_data[(*pindex)++] = END_OF_FIELDS;
return 0;
}
开发者ID:ydirson,项目名称:gnushogi,代码行数:32,代码来源:makepattern.c
示例14: field_count
int FilteredFieldStream::field_count() {
int numflds = 0;
for (;!eos(); next()) {
numflds++;
}
return numflds;
}
开发者ID:ismo1652,项目名称:jvmnotebook,代码行数:7,代码来源:reflectionUtils.cpp
示例15: autopickup_to_string
char *
autopickup_to_string(const struct nh_autopickup_rules *ar)
{
int size, i;
char *buf, *bp, pattern[40];
if (!ar || !ar->num_rules) {
buf = strdup("");
return buf;
}
/* at this point, size is an upper bound on the stringified length of ar 3
stringified small numbers + a pattern with up to 40 chars < 64 chars */
size = 64 * ar->num_rules;
buf = malloc(size);
buf[0] = '\0';
for (i = 0; i < ar->num_rules; i++) {
strncpy(pattern, ar->rules[i].pattern, sizeof (pattern));
/* remove '"' and ';' from the pattern by replacing them by '?' (single
character wildcard), to simplify parsing */
bp = pattern;
while (*bp) {
if (*bp == '"' || *bp == ';')
*bp = '?';
bp++;
}
snprintf(eos(buf), 64, "(\"%s\",%d,%u,%u);", pattern,
ar->rules[i].oclass, ar->rules[i].buc, ar->rules[i].action);
}
return buf;
}
开发者ID:eatnumber1,项目名称:bingehack4,代码行数:35,代码来源:options.c
示例16: dump_scratched_to
/* string "esc" before each line. esc==NULL would be interpreted as "". */
void dump_scratched_to (FILE *fp, char *esc)
{
static char BUFFER [BUFFER_SIZE];
char *end;
int should_print_esc = TRUE;
long position = 0, end_position;
end_position = ftell (fp_scratch);
if (end_position == 0) return;
rewind (fp_scratch);
while ( fgets (BUFFER, BUFFER_SIZE, fp_scratch) != NULL )
{ /* there are stuff read */
if (should_print_esc && (esc != NULL)) fputs (esc, fp);
end = eos(BUFFER);
position += end - BUFFER;
if (position >= end_position)
{
*(end + end_position - position) = EOS;
fputs (BUFFER, fp);
return;
}
else fputs (BUFFER, fp);
should_print_esc = (*(end-1)=='\n');
}
clearerr (fp_scratch);
return;
} /* end dump_scratched_to() */
开发者ID:dmt4,项目名称:atomeye,代码行数:27,代码来源:scratch.c
示例17: req_readMacId
/* return the number of char copied to dest. */
int req_readMacId(REQ_FILE* rf, char* dest, int max)
{
MACRO* mac;
char* mc_value;
int i;
*dest= '\0';
max= max-1;
i= 0;
req_skipComment(rf);
while(!eos(rf) && (current(rf)=='$' || isidchar(current(rf))) && (i<max)) {
if(current(rf)=='$') {
mac= readMacro(rf);
if(mac==NULL) {
*dest= '\0';
return -1;
}
mc_value= mac->value;
while((i<max) && !END(mc_value)) {
*(dest++)= *(mc_value++);
i++;
}
} else {
*(dest++)= current(rf);
i++;
req_readChar(rf);
}
}
*dest= '\0';
req_skipComment(rf);
return i;
}
开发者ID:ukaea,项目名称:epics,代码行数:35,代码来源:req_file.c
示例18: skipBytes
void skipBytes(size32_t size)
{
cur += size;
available -= size;
// call eos() to ensure stream->eos() is true if this class has got to the end of the stream
eos();
}
开发者ID:AttilaVamos,项目名称:HPCC-Platform,代码行数:7,代码来源:rtlcommon.hpp
示例19: strcpy
/* fill and return the given buffer with the long nethack version string */
char *getversionstring(char *buf)
{
strcpy(buf, VERSION_ID);
#if defined(BETA) && defined(BETA_INFO)
sprintf(eos(buf), " %s", BETA_INFO);
#endif
return buf;
}
开发者ID:ictxiangxin,项目名称:LoongHack,代码行数:9,代码来源:version.c
示例20: req_gotoSection
/* -1 otherwise. */
int req_gotoSection(REQ_FILE* rf, char* section)
{
char buff[21];
int i;
req_rewindFile(rf);
while(1) {
while(!eos(rf) && (current(rf)!='[')) req_skipLine(rf);
if(eos(rf)) return -1;
/* skip '[' */
req_readChar(rf);
i= 0;
while(!eos(rf) && (current(rf)!=']') && (i<20)) {
buff[i++]= current(rf);
req_readChar(rf);
}
buff[i]= '\0';
/* we've not find a closing sq bracket */
if(current(rf)!=']') return -1;
/* skip the rest of the line */
req_skipLine(rf);
/* have we find the correct section */
if(strcmp(buff, section)==0) break;
if(eos(rf)) return -1;
}
strcpy(rf->sect_name, section);
rf->sect_start= ftell(rf->fd)-1;
/* search the end of the section */
while(!eos(rf) && (current(rf)!='[')) req_skipLine(rf);
rf->sect_end= ftell(rf->fd)-1;
fseek(rf->fd, rf->sect_start, SEEK_SET);
req_readChar(rf);
req_skipComment(rf);
return 0;
}
开发者ID:ukaea,项目名称:epics,代码行数:46,代码来源:req_file.c
注:本文中的eos函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论