本文整理汇总了C++中parseArgs函数的典型用法代码示例。如果您正苦于以下问题:C++ parseArgs函数的具体用法?C++ parseArgs怎么用?C++ parseArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parseArgs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MAIN
MAIN(argc, argv) {
TIMER_T start;
TIMER_T stop;
GOTO_REAL();
parseArgs(argc, (char** const)argv);
long sz = (long)global_params[PARAM_SIZE];
global_array = (aligned_type_t*) malloc(sz * sizeof(aligned_type_t));
long k = 0;
for (; k < sz; k++) {
global_array[k].value = 0;
}
long numThread = global_params[PARAM_THREADS];
SIM_GET_NUM_CPU(numThread);
TM_STARTUP(numThread);
P_MEMORY_STARTUP(numThread);
thread_startup(numThread);
printf("Running clients... ");
fflush(stdout);
TIMER_READ(start);
GOTO_SIM();
thread_start(client_run, (void*)&numThread);
GOTO_REAL();
TIMER_READ(stop);
puts("done.");
printf("Time = %0.6lf\n", TIMER_DIFF_SECONDS(start, stop));
fflush(stdout);
long i = 0;
long sum = 0;
for (;i < sz; i++) {
sum += global_array[i].value;
// printf("%ld\n", global_array[i].value);
}
if (sum != 0) {
printf("Problem, sum was not zero!: %ld\n", sum);
}
TM_SHUTDOWN();
P_MEMORY_SHUTDOWN();
GOTO_SIM();
thread_shutdown();
MAIN_RETURN(0);
}
示例2: PyErr_SetArgsError
static PyObject *t_regexmatcher_appendReplacement(t_regexmatcher *self,
PyObject *args)
{
UnicodeString *u0, _u0;
UnicodeString *u1, _u1;
if (!parseArgs(args, "SS", &u0, &_u0, &u1, &_u1))
{
STATUS_CALL(self->object->appendReplacement(*u0, *u1, status));
Py_RETURN_SELF();
}
return PyErr_SetArgsError((PyObject *) self, "appendReplacement", args);
}
示例3: main
int main(int argc, const char **argv) {
if (parseArgs(argc, argv) < 0) {
puts("ERROR: failure parsing args.");
return -1;
}
if (initController() < 0) {
puts("ERROR: failure in setup function.");
return -1;
}
enterLoop();
return 0;
}
示例4: main
int main(int argc, char** argv)
{
if (init(argc, argv)) return -1;
if (parseArgs(argc, argv)) return -1;
if (checkSubstitutes()) return -1;
if (getRuntime()) return -1;
switch (runtime)
{
case JavaRuntime: return runJava();
case DotnetRuntime: return runDotnet();
default: return err("internal error in main");
}
return 0;
}
示例5: PyErr_SetArgsError
static PyObject *t_searchiterator_setAttribute(t_searchiterator *self,
PyObject *args)
{
USearchAttribute attribute;
USearchAttributeValue value;
if (!parseArgs(args, "ii", &attribute, &value))
{
STATUS_CALL(self->object->setAttribute(attribute, value, status));
Py_RETURN_NONE;
}
return PyErr_SetArgsError((PyObject *) self, "setAttribute", args);
}
示例6: main
int main(int argc, char** argv)
{
//Determine which switches are activated early on
parseArgs(argc,argv);
//this int will be used to print lines held in char**
int i;
//arbitrary sizes that will be used to allocate memory for char* and char**
int size = 32;
int size2 = 32;
//arr_str will hold the strings of each line
char ** arr_str = malloc(size * sizeof(char*));
//will be used to read each character of line
char * str = malloc(size2 * sizeof(char));
//num_sentences is really number of lines
int num_sentences = 0;
/*
* This while loop places all of the characters of the stdin into the str array
* of characters and ensures the arr_str is large enough to hold all the
* character arrays
*/
while( (str = readline()) ){
if(num_sentences == size)
arr_str = realloc(arr_str, sizeof(char)*(size*=2));
/*
* To make life easier, swap the characters in a line before they're placed
* into the arr_str since they will always be switched (-c is assumed)
*/
if(c) swapline(str);
//Place character arrays into arr_str
arr_str[num_sentences++] = str;
}
/*
* Call the swaplineorder function that takes an array of "strings" and the number
* of lines to be switched
*/
if(l) swaplineorder(arr_str, num_sentences);
//Once the switches have been accounted for, print the desired product
for(i = 0; i < num_sentences; i++){
puts(arr_str[i]);
}
return 0;
}
示例7: main
int main(int argc, char *argv[])
{
serverInputs inputs;
struct sigaction sa;
int sd;
pid_t pid;
logger * logg;
/*Parse all Arguments*/
memset(&inputs, 0, sizeof(serverInputs));
parseArgs(&inputs, argc, argv);
printf("Log File Path: %s\n", inputs.logPath);
printf("Documents Path: %s\n", inputs.directory);
logg = init_logger(inputs.logPath);
sd = init_socket(&inputs);
sa.sa_handler = kidhandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
if (sigaction(SIGCHLD, &sa, NULL) == -1)
err(1, "sigaction failed");
printf("Server up and listening on port: %d\n", inputs.port);
daemon(1,1);
for(;;) {
request req;
memset(&req, 0, sizeof(req));
req.l = logg;
int clientsd = accept_connection(sd, &req.client);
req.inputsDIR = inputs.directory;
req.requestSD = &clientsd;
pid = fork();
if (pid == -1)
err(1, "fork failed");
if(pid == 0) {
handle_request(&req);
exit(0);
}
close(clientsd);
}
}
示例8: main
int main(int argc, char** argv){
//define the files to be used
char *fileName, *inputFile, *outFile;
int port;
long fileLength=0;
int opt, err;
//add salt according to taste
char *password, *salt = "NaCl";
int keyLength = 32, macLength = 32, blockLength = 16;
int numberOfIterations = 4096;
char *initCounter;
char *key;
//parse the arguments and let the program decide the mode to be followed
opt = parseArgs(argc, argv, &fileName, NULL, &port);
checkErr(opt, USAGE_STR);
if(D_DAEMON == opt){
err = receiveFile(port, &inputFile, &fileLength);
checkErr(err, "File receive error");
} else if(L_LOCAL == opt){
err = readFile(fileName, &fileLength, &inputFile );
checkErr(err, "File read error");
}
password = getpass("Password:");
initializeGcryptRoutine();
err = keyDerivation(password, salt, numberOfIterations, keyLength, &key);
checkErr(err, "Key derivation error");
printKey(key, keyLength);
err = verifyMac(key, keyLength, inputFile, fileLength, macLength);
checkErr(err, "HMAC verification error");
initCounter = (char*)(malloc(blockLength * sizeof(char)));
memset((void *)initCounter, 0, (size_t)(blockLength * sizeof(char)));
err = aesCounter(key, keyLength, inputFile, fileLength - macLength, initCounter,
blockLength, &outFile);
checkErr(err, "Decryption error");
err = writeFile(fileName, outFile, fileLength - macLength, NULL, 1, opt);
checkErr(err, "Error in output file operation");
printf("%ld bytes written.\n", fileLength - macLength);
return 0;
}
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
int nLevel = 1;
if (a.arguments().contains("--verbose"))
{
nLevel = 0;
}
Logger::setInstance(new Logger(nLevel, QString("%1/.Hobbyist_Software/VLC_Streamer/").arg(QDir::homePath())));
LOG_IN("VLCStreamer Client Started");
a.setOrganizationName("Hobbyist_Software");
a.setOrganizationDomain("Hobbyist_Software.Com");
a.setApplicationName("VLC_Streamer");
a.setApplicationVersion(APP_VERSION);
LOG_IN(QString(" Version %1").arg(a.applicationVersion()));
LOG_IN(QString(" Beta"));
//LOG_IN(QString(" (c) J.Stockhausen"));
parseArgs(a.arguments());
if (!VLCEncoder::hasSystemValidVLC())
{
return 1;
}
VLCStreamer streamer;
MainDialog w(&streamer);
w.show();
streamer.slotStartService();
int ret = a.exec();
streamer.slotStopService();
Logger::setInstance(0);
return ret;
}
示例10: switch
static PyObject *t_resourcebundle_getStringEx(t_resourcebundle *self,
PyObject *args)
{
UnicodeString *u;
UnicodeString _u;
charsArg key;
int i;
switch (PyTuple_Size(args)) {
case 1:
if (!parseArgs(args, "i", &i))
{
STATUS_CALL(_u = self->object->getStringEx(i, status));
return PyUnicode_FromUnicodeString(&_u);
}
if (!parseArgs(args, "n", &key))
{
STATUS_CALL(_u = self->object->getStringEx(key, status));
return PyUnicode_FromUnicodeString(&_u);
}
case 2:
if (!parseArgs(args, "iU", &i, &u))
{
STATUS_CALL(u->setTo(self->object->getStringEx(i, status)));
Py_RETURN_ARG(args, 1);
}
if (!parseArgs(args, "nU", &key, &u))
{
STATUS_CALL(u->setTo(self->object->getStringEx(key, status)));
Py_RETURN_ARG(args, 1);
}
break;
}
return PyErr_SetArgsError((PyObject *) self, "getStringEx", args);
}
示例11: parseArgs
MStatus skinClusterWeights::doIt( const MArgList& args )
//
// Description
//
{
MStatus status = parseArgs(args);
if (status != MS::kSuccess) return status;
if (editUsed) {
redoIt();
} else if (queryUsed) {
doItQuery();
}
return MS::kSuccess;
}
示例12: main
int main(int argc, char const *argv[])
{
try
{
parseArgs(argc-1, argv+1);
}
catch (std::exception const &x)
{
error(std::string("Error during command option parsing: ") + x.what());
}
mainLoop();
return 0;
}
示例13: main
int main(int argc, char* argv[])
{
parseArgs(argc, argv);
sTitle = "eiskaltdcpp-daemon (EiskaltDC++ core 2.2)";
#ifdef _DEBUG
sTitle += " [debug]";
#endif
Util::PathsMap override;
if (config_dir[0] != 0) {
override[Util::PATH_USER_CONFIG] = config_dir;
override[Util::PATH_USER_LOCAL] = config_dir;
}
示例14: main
int main(int argc, char* argv[]){
int ret;
AppContext ctx;
ret = parseArgs(argc, argv, ctx);
CHECK_RETURN(ret);
ret = loadWords(ctx);
CHECK_RETURN(ret);
ret = process(ctx);
return ret;
}
示例15: main
// Function Definitions ******************************************************
int main (int argc, char* argv[]) {
#ifdef _DEBUG
std::cout << caesarCipherUnitTests () << std::endl;
#endif
if (!parseArgs (argc, argv)) {
return -1;
}
return 0;
}