本文整理汇总了C++中stdString::append方法的典型用法代码示例。如果您正苦于以下问题:C++ stdString::append方法的具体用法?C++ stdString::append怎么用?C++ stdString::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stdString
的用法示例。
在下文中一共展示了stdString::append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeDataFileName
void DataWriter::makeDataFileName(int serial, stdString &name)
{
int len;
char buffer[30];
if (data_file_name_base.length() > 0)
{
name = data_file_name_base;
if (serial > 0)
{
len = snprintf(buffer, sizeof(buffer), "-%d", serial);
if (len >= (int)sizeof(buffer))
len = sizeof(buffer)-1;
name.append(buffer, len);
}
return;
}
// Else: Create name based on "<today>[-serial]"
int year, month, day, hour, min, sec;
unsigned long nano;
epicsTime now = epicsTime::getCurrent();
epicsTime2vals(now, year, month, day, hour, min, sec, nano);
if (serial > 0)
len = snprintf(buffer, sizeof(buffer),
"%04d%02d%02d-%d", year, month, day, serial);
else
len = snprintf(buffer,sizeof(buffer),
"%04d%02d%02d", year, month, day);
if (len >= (int)sizeof(buffer))
len = sizeof(buffer)-1;
name.assign(buffer, len);
}