本文整理汇总了C++中string类的典型用法代码示例。如果您正苦于以下问题:C++ string类的具体用法?C++ string怎么用?C++ string使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了string类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReportStranded
// =========================================================
// Convenience method for reporting merged blocks by strand
// =========================================================
void BedMerge::ReportStranded(string chrom, int start,
int end, const vector<string> &names,
const vector<string> &scores, int mergeCount,
string strand)
{
// ARQ: removed to force all output to be zero-based, BED format, reagrdless of input type
//if (_bed->isZeroBased == false) {start++;}
printf("%s\t%d\t%d", chrom.c_str(), start, end);
// just the merged intervals
if (_numEntries == false && _reportNames == false &&
_reportScores == false) {
printf("\t%s\n", strand.c_str());
}
// merged intervals and counts
else if (_numEntries == true && _reportNames == false &&
_reportScores == false) {
printf("\t%d\t%s\n", mergeCount, strand.c_str());
}
// merged intervals, counts, and scores
else if (_numEntries == true && _reportNames == false &&
_reportScores == true) {
printf("\t%d", mergeCount);
ReportMergedScores(scores);
printf("\t%s\n", strand.c_str());
}
// merged intervals, counts, and names
else if (_numEntries == true && _reportNames == true &&
_reportScores == false) {
ReportMergedNames(names);
printf("\t%d\t%s", mergeCount, strand.c_str());
printf("\n");
}
// merged intervals, counts, names, and scores
else if (_numEntries == true && _reportNames == true &&
_reportScores == true) {
ReportMergedNames(names);
ReportMergedScores(scores);
printf("\t%s\t%d", strand.c_str(), mergeCount);
printf("\n");
}
// merged intervals and names
else if (_numEntries == false && _reportNames == true &&
_reportScores == false) {
ReportMergedNames(names);
printf("\t%s\n", strand.c_str());
}
// merged intervals and scores
else if (_numEntries == false && _reportNames == false &&
_reportScores == true) {
ReportMergedScores(scores);
printf("\t%s\n", strand.c_str());
}
// merged intervals, names, and scores
else if (_numEntries == false && _reportNames == true &&
_reportScores == true) {
ReportMergedNames(names);
ReportMergedScores(scores);
printf("\t%s\n", strand.c_str());
}
}
示例2: fscanf
/* You need to read the configuration file and extract the page size and number of pages
* (these two parameter together define the maximum main memory you can use).
* Values are in number of bytes.
* You should read the names of the tables from the configuration file.
* You can assume that the table data exists in a file named <table_name>.csv at the path
* pointed by the config parameter PATH_FOR_DATA.
***************************************************************************************/
void DBSystem::readConfig(string configFilePath)
{
FILE *fd=fopen(configFilePath.c_str(),"rw+");
int count=0;
char* temp=new char[100];
bool isBegin=false;
bool isInTable=false;
if(fd==NULL)
cout<<"Config file not found"<<endl;
fscanf (fd, "%s %d", temp, &pageSize);
fscanf (fd, "%s %d", temp, &(numberOfPages));
fscanf (fd, "%s %s", temp, (pathForData));
fclose(fd);
string sLine="";
ifstream infile;
infile.open(configFilePath.c_str());
getline(infile, sLine);
getline(infile, sLine);
getline(infile, sLine);
//cout<<sLine;
//cout<<"Page size is : "<< pageSize << endl;
//cout<<"Number of pages are : "<< numberOfPages <<endl;
//cout<<"Path for table files is : "<< pathForData <<endl;
string currentTableName;
while(!infile.eof())
{
string current("");
getline(infile, current);
//cout << current<<endl;
if( current.find("BEGIN") != -1 && !isBegin)
{
count=0;
isBegin=true;
continue;
}
else if( current.find("END") != -1 )
{
if(count++==1)
break;
isBegin=false;
isInTable=false;
continue;
}
if(isBegin)
{
isInTable=true;
isBegin=false;
tableNames.push_back(current.substr(0,current.length()));
currentTableName=current;
tableNameToPrimaryKeys[currentTableName]="";
}
else if(isInTable)
{
int index=current.find(',');
string currentColumnName=current.substr(0,index);
int len=current.length();
string currentDataType=current.substr(index+1,len);
// cout<<currentDataType<<endl;
currentColumnName=removeSpaces(currentColumnName);
currentDataType=removeSpaces(currentDataType);
if(currentDataType.find("varchar")!=string::npos || currentDataType.find("VARCHAR")!=string::npos)
currentDataType="VARCHAR";
if(currentDataType=="integer")
currentDataType="INT";
if(currentDataType=="float")
currentDataType="FLOAT";
if(currentColumnName.compare("PRIMARY_KEY")==0){
// cout<<currentTableName<<" "<<currentDataType<<endl;
tableNameToPrimaryKeys[currentTableName]=currentDataType;
}
else{
std::pair < string,string > bar = std::make_pair (currentColumnName,currentDataType);
tableNameToColumnNames[currentTableName].push_back(bar);
//.........这里部分代码省略.........
示例3: DBG
bool DSMFactory::loadConfig(const string& conf_file_name, const string& conf_name,
bool live_reload, DSMStateDiagramCollection* m_diags) {
string script_name = conf_name.substr(0, conf_name.length()-5); // - .conf
DBG("loading %s from %s ...\n", script_name.c_str(), conf_file_name.c_str());
AmConfigReader cfg;
if(cfg.loadFile(conf_file_name))
return false;
DSMScriptConfig script_config;
script_config.RunInviteEvent =
cfg.getParameter("run_invite_event")=="yes";
script_config.SetParamVariables =
cfg.getParameter("set_param_variables")=="yes";
script_config.config_vars.insert(cfg.begin(), cfg.end());
if (live_reload) {
INFO("live DSM config reload does NOT reload prompts and prompt sets!\n");
INFO("(see http://tracker.iptel.org/browse/SEMS-68)\n");
} else {
if (!loadPrompts(cfg))
return false;
if (!loadPromptSets(cfg))
return false;
}
DSMStateDiagramCollection* used_diags;
if (m_diags != NULL)
used_diags = m_diags; // got this from caller (main diags)
else {
// create a new set of diags
used_diags = script_config.diags = new DSMStateDiagramCollection();
}
if (!loadDiags(cfg, used_diags))
return false;
vector<string> registered_apps;
if (!registerApps(cfg, used_diags, registered_apps))
return false;
ScriptConfigs_mut.lock();
try {
Name2ScriptConfig[script_name] = script_config;
// set ScriptConfig to this for all registered apps' names
for (vector<string>::iterator reg_app_it=
registered_apps.begin(); reg_app_it != registered_apps.end(); reg_app_it++) {
string& app_name = *reg_app_it;
// dispose of the old one, if it exists
map<string, DSMScriptConfig>::iterator it=ScriptConfigs.find(app_name);
if (it != ScriptConfigs.end()) {
// may be in use by active call - don't delete but save to
// old_diags for garbage collection (destructor)
if (it->second.diags != NULL)
old_diags.insert(it->second.diags);
}
// overwrite with new config
ScriptConfigs[app_name] = script_config;
}
} catch(...) {
ScriptConfigs_mut.unlock();
throw;
}
ScriptConfigs_mut.unlock();
bool res = true;
vector<string> system_dsms = explode(cfg.getParameter("run_system_dsms"), ",");
for (vector<string>::iterator it=system_dsms.begin(); it != system_dsms.end(); it++) {
string status;
if (createSystemDSM(script_name, *it, live_reload, status)) {
} else {
ERROR("creating system DSM '%s': '%s'\n", it->c_str(), status.c_str());
res = false;
}
}
return res;
}
示例4: _tWinMain
//.........这里部分代码省略.........
//////////////////////////
//initialize random number
//////////////////////////
srand((unsigned)time(0));
pFILE = fopen("devices.txt","w");
///////////////////////
//initialize port audio
///////////////////////
global_err = Pa_Initialize();
if( global_err != paNoError )
{
//MessageBox(0,"portaudio initialization failed",0,MB_ICONERROR);
if(pFILE) fprintf(pFILE, "portaudio initialization failed.\n");
fclose(pFILE);
return 1;
}
////////////////////////
//audio device selection
////////////////////////
//SelectAudioInputDevice();
SelectAudioOutputDevice();
/*
// Create an api map.
std::map<int, std::string> apiMap;
apiMap[RtAudio::MACOSX_CORE] = "OS-X Core Audio";
apiMap[RtAudio::WINDOWS_ASIO] = "Windows ASIO";
apiMap[RtAudio::WINDOWS_DS] = "Windows Direct Sound";
apiMap[RtAudio::UNIX_JACK] = "Jack Client";
apiMap[RtAudio::LINUX_ALSA] = "Linux ALSA";
apiMap[RtAudio::LINUX_OSS] = "Linux OSS";
apiMap[RtAudio::RTAUDIO_DUMMY] = "RtAudio Dummy";
std::vector< RtAudio::Api > apis;
RtAudio::getCompiledApi(apis);
fprintf(pFILE, "\nCompiled APIs:\n");
for (unsigned int i = 0; i<apis.size(); i++)
fprintf(pFILE, " %s\n ", apiMap[apis[i]] );
fprintf(pFILE, "\nCurrent API: %s\n", apiMap[global_dac.getCurrentApi()]);
unsigned int devices = global_dac.getDeviceCount();
fprintf(pFILE, "\nFound %i device(s) ...\n", devices);
*/
/*
// Configure RtAudio
global_rtParams.deviceId = global_dac.getDefaultOutputDevice();
global_rtParams.nChannels = NUM_CHANNELS;
unsigned int sampleRate = SAMPLE_RATE;
unsigned int bufferFrames = 512; // 512 sample frames
*/
// You don't necessarily have to do this - it will default to 44100 if not set.
Tonic::setSampleRate(SAMPLE_RATE);
开发者ID:oifii,项目名称:spitonicsimplestepseqsynthvoroguiwin32_vs2013,代码行数:67,代码来源:spitonicsimplestepseqsynthvoroguiwin32.cpp
示例5: srand
void TestSuite::menu_tests( string spec_file_path )
{
ifstream fin;
ofstream fout_tst, fout_ans;
string tst_filename = "menu_test_";
string ans_filename = "menu_ans_";
string read;
stringstream ss;
int num_test_files = -1;
double max, min = 0;
int rand_int = 0;
float rand_float = 0;
srand (time(NULL));
system("mkdir -p tests");
char ans[128] = {'\0'};
while (strcmp(ans,"y") && strcmp(ans,"n") )
{
for (int i = 0; i < 128; i++)
ans[i] = '\0';
cout << "Would you like to generate files for testing menues? (y/n): " << endl;
cin >> ans;
}
if (!strcmp(ans,"y") )
{
// open .spec file check for success
fin.open(spec_file_path.c_str());
if (!fin)
return;
fin.close();
//display menu for range, number of test cases
while ( num_test_files < 0 || num_test_files > 100)
{
cout << "Enter number of test files to generate for menu testing (between 0 and 100): ";
cin >> num_test_files;
cout << endl;
}
cout <<
"\nWhat is the MINIMUM value you would like the randomly generated values to be?"
<< "\n Number between –2147483648 to 2147483646"<< endl;
cin >> min;
cout <<
"\nWhat is the MAXIMUM value you would like the randomly generated values to be?"
<< "\n Number between –2147483647 to 2147483647"<< endl;
cin >> max;
while(max <= min)
{
cout << "\n Maximum must be larger than mimimum." << endl;
cout <<
"\nWhat is the MINIMUM value you would like the randomly generated values to be?"
<< "\n Number between –2147483648 to 2147483646"<< endl;
cin >> min;
cout <<
"\nWhat is the MAXIMUM value you would like the randomly generated values to be?"
<< "\n Number between –2147483647 to 2147483647"<< endl;
cin >> max;
}
double range = max - min;
//generate .tst files
for (int i = 0; i < num_test_files;i++)
{
string test_filename = tst_filename;
string answer_filename = ans_filename;
//generate time stamp
time_t rawTime;
tm * timeInfo;
char buffer [40];
string i_to_string = "";
ss.str("");
time (&rawTime);
timeInfo = localtime (&rawTime);
strftime (buffer,40,"%d_%m_%y_%H_%M_%S",timeInfo);
string curr_time(buffer);
ss << i+1;
i_to_string = ss.str();
test_filename += i_to_string;
answer_filename += i_to_string;
test_filename = test_filename + "_" + curr_time + ".tst";
answer_filename = answer_filename + "_" + curr_time + ".ans";
fin.open(spec_file_path.c_str());
fout_ans.open(answer_filename.c_str());
fout_tst.open(test_filename.c_str());
//open .tst and .ans files for output
while ( fin >> read )
{
//.........这里部分代码省略.........
示例6: exists
//Uses stat to check if the specified file exists
static bool exists(string p)
{
struct stat DirInfo;
int err = stat(p.c_str(), &DirInfo);
return (err == 0);
}
示例7: main
/*******************************************************************************
* For each run, the input filename and restart information (if needed) must *
* be given on the command line. For non-restarted case, command line is: *
* *
* executable <input file name> *
* *
* For restarted run, command line is: *
* *
* executable <input file name> <restart directory> <restart number> *
* *
*******************************************************************************/
int main(int argc, char* argv[])
{
// Initialize libMesh, PETSc, MPI, and SAMRAI.
LibMeshInit init(argc, argv);
SAMRAI_MPI::setCommunicator(PETSC_COMM_WORLD);
SAMRAI_MPI::setCallAbortInSerialInsteadOfExit();
SAMRAIManager::startup();
{ // cleanup dynamically allocated objects prior to shutdown
// Parse command line options, set some standard options from the input
// file, initialize the restart database (if this is a restarted run),
// and enable file logging.
Pointer<AppInitializer> app_initializer = new AppInitializer(argc, argv, "IB.log");
Pointer<Database> input_db = app_initializer->getInputDatabase();
// Setup user-defined kernel function.
LEInteractor::s_kernel_fcn = &kernel;
LEInteractor::s_kernel_fcn_stencil_size = 8;
// Get various standard options set in the input file.
const bool dump_viz_data = app_initializer->dumpVizData();
const int viz_dump_interval = app_initializer->getVizDumpInterval();
const bool uses_visit = dump_viz_data && app_initializer->getVisItDataWriter();
const bool uses_exodus = dump_viz_data && !app_initializer->getExodusIIFilename().empty();
const string exodus_filename = app_initializer->getExodusIIFilename();
const bool dump_restart_data = app_initializer->dumpRestartData();
const int restart_dump_interval = app_initializer->getRestartDumpInterval();
const string restart_dump_dirname = app_initializer->getRestartDumpDirectory();
const bool dump_postproc_data = app_initializer->dumpPostProcessingData();
const int postproc_data_dump_interval = app_initializer->getPostProcessingDataDumpInterval();
const string postproc_data_dump_dirname = app_initializer->getPostProcessingDataDumpDirectory();
if (dump_postproc_data && (postproc_data_dump_interval > 0) && !postproc_data_dump_dirname.empty())
{
Utilities::recursiveMkdir(postproc_data_dump_dirname);
}
const bool dump_timer_data = app_initializer->dumpTimerData();
const int timer_dump_interval = app_initializer->getTimerDumpInterval();
// Create a simple FE mesh.
Mesh solid_mesh(NDIM);
const double dx = input_db->getDouble("DX");
const double ds = input_db->getDouble("MFAC") * dx;
string elem_type = input_db->getString("ELEM_TYPE");
const double R = 0.5;
if (NDIM == 2 && (elem_type == "TRI3" || elem_type == "TRI6"))
{
const int num_circum_nodes = ceil(2.0 * M_PI * R / ds);
for (int k = 0; k < num_circum_nodes; ++k)
{
const double theta = 2.0 * M_PI * static_cast<double>(k) / static_cast<double>(num_circum_nodes);
solid_mesh.add_point(libMesh::Point(R * cos(theta), R * sin(theta)));
}
TriangleInterface triangle(solid_mesh);
triangle.triangulation_type() = TriangleInterface::GENERATE_CONVEX_HULL;
triangle.elem_type() = Utility::string_to_enum<ElemType>(elem_type);
triangle.desired_area() = 1.5 * sqrt(3.0) / 4.0 * ds * ds;
triangle.insert_extra_points() = true;
triangle.smooth_after_generating() = true;
triangle.triangulate();
}
else
{
// NOTE: number of segments along boundary is 4*2^r.
const double num_circum_segments = 2.0 * M_PI * R / ds;
const int r = log2(0.25 * num_circum_segments);
MeshTools::Generation::build_sphere(solid_mesh, R, r, Utility::string_to_enum<ElemType>(elem_type));
}
// Ensure nodes on the surface are on the analytic boundary.
MeshBase::element_iterator el_end = solid_mesh.elements_end();
for (MeshBase::element_iterator el = solid_mesh.elements_begin(); el != el_end; ++el)
{
Elem* const elem = *el;
for (unsigned int side = 0; side < elem->n_sides(); ++side)
{
const bool at_mesh_bdry = !elem->neighbor(side);
if (!at_mesh_bdry) continue;
for (unsigned int k = 0; k < elem->n_nodes(); ++k)
{
if (!elem->is_node_on_side(k, side)) continue;
Node& n = *elem->get_node(k);
n = R * n.unit();
}
}
}
//.........这里部分代码省略.........
示例8: if
//.........这里部分代码省略.........
if (wd.targetBorder > 1.0f) {
logOutput.Print("warning: targetBorder truncated to 1 (was %f)", wd.targetBorder);
wd.targetBorder = 1.0f;
} else if (wd.targetBorder < -1.0f) {
logOutput.Print("warning: targetBorder truncated to -1 (was %f)", wd.targetBorder);
wd.targetBorder = -1.0f;
}
wd.cylinderTargetting = wdTable.GetFloat("cylinderTargetting", melee ? 1.0f : 0.0f);
wd.range = wdTable.GetFloat("range", 10.0f);
const float accuracy = wdTable.GetFloat("accuracy", 0.0f);
const float sprayAngle = wdTable.GetFloat("sprayAngle", 0.0f);
const float movingAccuracy = wdTable.GetFloat("movingAccuracy", accuracy);
// should really be tan but TA seem to cap it somehow
// should also be 7fff or ffff theoretically but neither seems good
wd.accuracy = sin((accuracy) * PI / 0xafff);
wd.sprayAngle = sin((sprayAngle) * PI / 0xafff);
wd.movingAccuracy = sin((movingAccuracy) * PI / 0xafff);
wd.targetMoveError = wdTable.GetFloat("targetMoveError", 0.0f);
wd.leadLimit = wdTable.GetFloat("leadLimit", -1.0f);
wd.leadBonus = wdTable.GetFloat("leadBonus", 0.0f);
// setup the default damages
const LuaTable dmgTable = wdTable.SubTable("damage");
float defDamage = dmgTable.GetFloat("default", 0.0f);
if (defDamage == 0.0f) {
defDamage = 1.0f; //avoid division by zeroes
}
for (int a = 0; a < damageArrayHandler->GetNumTypes(); ++a) {
wd.damages[a] = defDamage;
}
map<string, float> damages;
dmgTable.GetMap(damages);
map<string, float>::const_iterator di;
for (di = damages.begin(); di != damages.end(); ++di) {
const int type = damageArrayHandler->GetTypeFromName(di->first);
if (type != 0) {
float dmg = di->second;
if (dmg != 0.0f) {
wd.damages[type] = dmg;
} else {
wd.damages[type] = 1.0f;
}
}
}
wd.damages.impulseFactor = wdTable.GetFloat("impulseFactor", 1.0f);
wd.damages.impulseBoost = wdTable.GetFloat("impulseBoost", 0.0f);
wd.damages.craterMult = wdTable.GetFloat("craterMult", wd.damages.impulseFactor);
wd.damages.craterBoost = wdTable.GetFloat("craterBoost", 0.0f);
wd.areaOfEffect = wdTable.GetFloat("areaOfEffect", 8.0f) * 0.5f;
wd.edgeEffectiveness = wdTable.GetFloat("edgeEffectiveness", 0.0f);
// prevent 0/0 division in CGameHelper::Explosion
if (wd.edgeEffectiveness > 0.999f) {
wd.edgeEffectiveness = 0.999f;
}
wd.projectilespeed = wdTable.GetFloat("weaponVelocity", 0.0f) / GAME_SPEED;
wd.startvelocity = max(0.01f, wdTable.GetFloat("startVelocity", 0.0f) / GAME_SPEED);
wd.weaponacceleration = wdTable.GetFloat("weaponAcceleration", 0.0f) / GAME_SPEED / GAME_SPEED;
wd.reload = wdTable.GetFloat("reloadTime", 1.0f);
wd.salvodelay = wdTable.GetFloat("burstRate", 0.1f);
示例9: check_size
bool check_size( const string& s, size_t sz ) {
return s.size( ) > sz;
}
示例10: check_size_
auto check_size_( const int& n, const string& s ) {
return to_string( n ).size( ) > s.size( );
}
示例11: isNumber
bool isNumber(string s) {
if (s.empty()) return false;
int i = 0;
while(isspace(s[i])) {
i++;
}
if (s[i] == '+' || s[i] == '-') {
i++;
}
bool eAppear = false;
bool dotAppear = false;
bool firstPart = false;
bool secondPart = false;
bool spaceAppear = false;
while(s[i] != '\0') {
if (s[i] == '.') {
if (dotAppear || eAppear || spaceAppear) {
return false;
} else {
dotAppear = true;
}
} else if (s[i] == 'e' || s[i] == 'E') {
if (eAppear || !firstPart || spaceAppear) {
return false;
} else {
eAppear = true;
}
} else if (isdigit(s[i])) {
if (spaceAppear) {
return false;
}
if (!eAppear) {
firstPart = true;
} else {
secondPart = true;
}
} else if (s[i] == '+' || s[i] == '-') {
if (spaceAppear) {
return false;
}
if (!eAppear || !(s[i - 1] == 'e' || s[i - 1] == 'E')) {
return false;
}
} else if (isspace(s[i])) {
spaceAppear = true;
} else {
return false;
}
i++;
}
if (!firstPart) {
return false;
} else if (eAppear && !secondPart) {
return false;
} else {
return true;
}
}
示例12:
/*
* Apply delta
*/
bool CReferenceBuilder::updateReference(std::vector<TUpdateList>& updateList,
const CTimestamp& baseTimestamp,
const CTimestamp& endTimestamp,
const string& refRootPath,
const string& refPath,
volatile bool* stopAsked)
{
if (updateList.empty())
return true;
uint i, j;
for (i=0; i<updateList.size(); ++i)
{
const TUpdateList& tableList = updateList[i];
if (tableList.empty())
continue;
CTableBuffer tableBuffer;
tableBuffer.init(i, refRootPath, refPath);
if (!tableBuffer.openAllRefFilesWrite())
{
nlwarning("CReferenceBuilder::updateReference(): failed to preopen all reference files for table '%d' in reference '%s'", i, refPath.c_str());
return false;
}
for (j=0; j<tableList.size(); ++j)
{
const CUpdateFile& update = tableList[j];
if (update.EndTime < baseTimestamp || update.StartTime >= endTimestamp)
continue;
if (!tableBuffer.applyDeltaChanges(update.Filename))
{
nlwarning("CReferenceBuilder::updateReference(): failed to apply delta file '%s'", update.Filename.c_str());
return false;
}
PDS_LOG_DEBUG(1)("CReferenceBuilder::updateReference(): updated reference with file '%s'", update.Filename.c_str());
}
}
return true;
}
示例13:
FragSpectrumScanDatabase::FragSpectrumScanDatabase(string id_par) :
scan2rt(0)
{
if(id_par.empty()) id = "no_id"; else id = id_par;
}
示例14: init_files
static void init_files(CursesWindow* window, const string& bbsdir) {
window->SetColor(SchemeId::PROMPT);
window->Puts("Creating Data Files.\n");
window->SetColor(SchemeId::NORMAL);
memset(&syscfg, 0, sizeof(configrec));
strcpy(syscfg.systempw, "SYSOP");
sprintf(syscfg.msgsdir, "%smsgs%c", bbsdir.c_str(), File::pathSeparatorChar);
sprintf(syscfg.gfilesdir, "%sgfiles%c", bbsdir.c_str(), File::pathSeparatorChar);
sprintf(syscfg.datadir, "%sdata%c", bbsdir.c_str(), File::pathSeparatorChar);
sprintf(syscfg.dloadsdir, "%sdloads%c", bbsdir.c_str(), File::pathSeparatorChar);
sprintf(syscfg.tempdir, "%stemp1%c", bbsdir.c_str(), File::pathSeparatorChar);
sprintf(syscfg.menudir, "%sgfiles%cmenus%c", bbsdir.c_str(), File::pathSeparatorChar, File::pathSeparatorChar);
strcpy(syscfg.systemname, "My WWIV BBS");
strcpy(syscfg.systemphone, " - - ");
strcpy(syscfg.sysopname, "The New Sysop");
syscfg.newusersl = 10;
syscfg.newuserdsl = 0;
syscfg.maxwaiting = 50;
// Always use 1 for the primary port.
syscfg.primaryport = 1;
syscfg.newuploads = 0;
syscfg.maxusers = 500;
syscfg.newuser_restrict = restrict_validate;
syscfg.req_ratio = 0.0;
syscfg.newusergold = 100.0;
valrec v;
v.ar = 0;
v.dar = 0;
v.restrict = 0;
v.sl = 10;
v.dsl = 0;
for (int i = 0; i < 10; i++) {
syscfg.autoval[i] = v;
}
for (int i = 0; i < 256; i++) {
slrec sl;
sl.time_per_logon = static_cast<uint16_t>((i / 10) * 10);
sl.time_per_day = static_cast<uint16_t>(((float)sl.time_per_logon) * 2.5);
sl.messages_read = static_cast<uint16_t>((i / 10) * 100);
if (i < 10) {
sl.emails = 0;
} else if (i <= 19) {
sl.emails = 5;
} else {
sl.emails = 20;
}
if (i <= 10) {
sl.posts = 10;
} else if (i <= 25) {
sl.posts = 10;
} else if (i <= 39) {
sl.posts = 4;
} else if (i <= 79) {
sl.posts = 10;
} else {
sl.posts = 25;
}
sl.ability = 0;
if (i >= 150) {
sl.ability |= ability_cosysop;
}
if (i >= 100) {
sl.ability |= ability_limited_cosysop;
}
if (i >= 90) {
sl.ability |= ability_read_email_anony;
}
if (i >= 80) {
sl.ability |= ability_read_post_anony;
}
if (i >= 70) {
sl.ability |= ability_email_anony;
}
if (i >= 60) {
sl.ability |= ability_post_anony;
}
if (i == 255) {
sl.time_per_logon = 255;
sl.time_per_day = 255;
sl.posts = 255;
sl.emails = 255;
}
syscfg.sl[i] = sl;
}
syscfg.userreclen = sizeof(userrec);
syscfg.waitingoffset = offsetof(userrec, waiting);
syscfg.inactoffset = offsetof(userrec, inact);
syscfg.sysstatusoffset = offsetof(userrec, sysstatus);
syscfg.fuoffset = offsetof(userrec, forwardusr);
syscfg.fsoffset = offsetof(userrec, forwardsys);
syscfg.fnoffset = offsetof(userrec, net_num);
syscfg.max_subs = 64;
//.........这里部分代码省略.........
示例15: log
void AndroidWrapper::log(string tag, string message){
__android_log_write(ANDROID_LOG_INFO, tag.c_str(), message.c_str());
}