本文整理汇总了C++中process_file函数的典型用法代码示例。如果您正苦于以下问题:C++ process_file函数的具体用法?C++ process_file怎么用?C++ process_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: try_main
int try_main(int argc, char* argv[])
{
bool error_flag = false;
statistics z;
for(int j = 1; j < argc; ++j)
{
try
{
z += process_file(argv[j]);
}
catch(...)
{
error_flag = true;
std::cerr << "Exception--file '" << argv[j] << "': " << std::flush;
report_exception();
}
}
z.print_summary();
return error_flag ? EXIT_FAILURE : EXIT_SUCCESS;
}
示例2: main
int
main(int argc, char *argv[])
{
int i = 1;
int retval = 0;
program_name = argv[0];
parse_int_env("EJ_MAX_LINE_LENGTH", &max_line_length);
parse_int_env("EJ_DISABLE_TABS", &disable_tabs);
parse_int_env("EJ_BASE_INDENT", &base_indent);
if (i >= argc) die("no files to check");
for (; i < argc; ++i) {
if (process_file(argv[i]) < 0) retval = 1;
}
return retval;
}
示例3: check_for_file
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
void check_for_file(TString &prev_line, TString txt = "../../data/daqcapture.dq0")
{
char txtline[256];
ifstream captured_file(txt);
captured_file.getline(txtline,sizeof(txtline));
if(strlen(txtline)==0)
{
cout<<"Error reading "<<txt<<endl;
return;
}
//cout<<txtline<<"\n";
if( !prev_line.CompareTo(txtline) ) return;
cout<<"File changed from "<<prev_line<<" to "<<txtline<<endl;
prev_line = txtline;
txt = "../../data/";
txt += txtline;
cout<<"File to process: "<<txt<<endl;
process_file(txt,-1);
}
示例4: main
int main(int argc, char **argv)
{
int i;
int result = 1;
if(argc == 1) {
version_info();
usage_info();
return EXIT_SUCCESS;
}
for(i=1; i<argc; i++)
if(result)
result = process_file(argv[i]);
if(result)
return EXIT_SUCCESS;
else
return EXIT_FAILURE;
}
示例5: process_path
static void
process_path(const char *path)
{
struct stat st;
int walkflags = FTW_CHDIR;
char *buf = NULL;
if (rflag) {
if (stat(path, &st) != -1 &&
(st.st_mode & S_IFMT) == S_IFDIR) {
outfn = 1; /* Print filename */
/*
* Add trailing slash if arg
* is directory, to resolve symlinks.
*/
if (path[strlen(path) - 1] != '/') {
(void) asprintf(&buf, "%s/", path);
if (buf != NULL)
path = buf;
}
/*
* Search through subdirs if path is directory.
* Don't follow symlinks if Rflag is not set.
*/
if (!Rflag)
walkflags |= FTW_PHYS;
if (nftw(path, recursive, MAX_DEPTH, walkflags) != 0) {
if (!sflag)
(void) fprintf(stderr,
gettext("%s: can't open \"%s\"\n"),
cmdname, path);
errors = 1;
}
return;
}
}
process_file(path, 0);
}
示例6: main
int main(int argc, char **argv)
{
char *in_filename;
char *out_filename;
int ch;
while ((ch = getopt_long(argc, argv, "b:c:", longopts, NULL)) != -1) {
switch (ch) {
case 'b':
parse_block_size(optarg);
break;
case 'c':
codec = optarg;
break;
default:
usage();
exit(1);
}
}
argc -= optind;
argv += optind;
if (argc == 2) {
in_filename = argv[0];
out_filename = argv[1];
} else if (argc == 1) {
in_filename = NULL;
out_filename = argv[0];
} else {
fprintf(stderr, "Can't read from multiple input files.\n");
usage();
exit(1);
}
/* Process the data file */
process_file(in_filename, out_filename);
return 0;
}
示例7: translate_file
static int
translate_file(const char *cpath, size_t offset, char *toString)
{
size_t base = 0;
LIST_MEMBER *pentry = NULL;
int res = 0;
char *path, *dpath;
dpath = path = convert_path(cpath);
if (!path)
return 1;
// The path could be absolute:
if (get_ImageBase(path, &base))
{
pentry = entry_lookup(&cache, path);
if (pentry)
{
path = pentry->path;
base = pentry->ImageBase;
if (base == INVALID_BASE)
{
l2l_dbg(1, "No, or invalid base address: %s\n", path);
res = 2;
}
}
else
{
l2l_dbg(1, "Not found in cache: %s\n", path);
res = 3;
}
}
if (!res)
{
res = process_file(path, offset, toString);
}
free(dpath);
return res;
}
示例8: process_path
static int process_path(const char *path)
{
int len;
struct stat st;
len = strlen(path);
if (has_symlink_leading_path(len, path))
return error("'%s' is beyond a symbolic link", path);
/*
* First things first: get the stat information, to decide
* what to do about the pathname!
*/
if (lstat(path, &st) < 0)
return process_lstat_error(path, errno);
if (S_ISDIR(st.st_mode))
return process_directory(path, len, &st);
return process_file(path, len, &st);
}
示例9: process_file_list
void process_file_list(
const char *const *file_name_index,
jmp_buf *jmp_if_error)
{
while(*file_name_index)
{
/* Check if the current file name is "-" */
if(strcmp(*file_name_index, STDIN_FILE_NAME) == 0)
{
/* The user specified standard input as a file to replace.
Filter standard input to standard output. */
process_file(STDIN_FILE_NAME, STDOUT_FILE_NAME, jmp_if_error);
}
else
{
/* Process current file in-place */
process_file_in_place(*file_name_index, jmp_if_error);
}
file_name_index++;
}
}
示例10: while
static char *process_token(char *p, object list)
{
char word[128], *w;
int inquote, noexpand;
while (*p && space(*p))
p++;
if (noexpand = inquote = *p == '"')
p++;
for (w=word ; *p && (!space(*p) || inquote) ; p++)
if (inquote && *p == '"')
inquote = 0;
else
*w++ = *p;
*w = '\0';
if (*word == '@')
process_file(list, word+1);
else if (*word)
process_word(word, list, noexpand);
return p;
}
示例11: main
int main(int argc, char **argv)
{
int i;
/* Process command line arguments and open input/output files. */
if (argc < 2) {
#ifdef VMS
printf("Usage: uaf_to_passwd [sysuaf-brief-list|$|~user]\n");
printf("($ spawns authorize to make SYSUAF.LIS file)\n");
#else
printf("Usage: uaf_to_passwd uaf_file\n");
#endif
return 0;
}
for (i = 1; i < argc; i++) {
process_file(argv[i]);
}
return 0;
}
示例12: process_rc_file
static void process_rc_file(const char *config)
{
char text[256];
if (!config) {
if (!access(".mspdebug", F_OK)) {
config = ".mspdebug";
} else {
const char *home = getenv("HOME");
if (home) {
snprintf(text, sizeof(text), "%s/.mspdebug",
home);
if (!access(text, F_OK))
config = text;
}
}
}
if (config)
process_file(config, 0);
}
示例13: process_files
//Given files just for this thread and global num found
void process_files(queue_t * loc_file_queue, unsigned int * num_found, char * to_find)
{
unsigned int local_num_found = 0;
//We have a list of files
//Loop through each of them
while(1)
{
queue_element_t * item = remove_from_queue(loc_file_queue);
if(item == NULL)
{
//Done increment global with local
(*num_found) +=local_num_found;
return;
}
//Get the str from this item
char * str = item->path_name;
//Process this dir
process_file(str, to_find, &local_num_found);
}
}
示例14: ReadFiles
void ReadFiles(POETCode* _files, LexState _lexStateStart, std::list<POETProgram*>& resultFiles)
{
POETCode* files = eval_AST(_files);
POETCode* p_files=files;
while (p_files != 0) {
POETList* fileList = dynamic_cast<POETList*>(p_files);
POETCode* fileCur = p_files;
if (fileList != 0) {
fileCur = fileList->get_first();
p_files=fileList->get_rest();
}
else p_files = 0;
std::string fname= fileCur->toString(OUTPUT_NO_DEBUG);
if (fname == "") {
std::cerr << "Empty file name: " << fileCur->toString() << " from list " << files->toString() << "\n";
}
lexState = _lexStateStart;
POETProgram* programFile = process_file(fname.c_str());
resultFiles.push_back(programFile);
lexState=LEX_DEFAULT;
}
}
示例15: process_fat
void process_fat(t_file_info *file_info)
{
struct fat_header *fat;
struct fat_arch *arch;
uint32_t n;
uint32_t offset;
t_file_info sub_file_info;
fat = file_info->data;
n = fat->nfat_arch;
n = swapuint32_t(n);
arch = file_info->data + sizeof(fat);
while (n)
{
if (swapuint32_t(arch->cputype) == CPU_TYPE_X86_64)
offset = arch->offset;
arch += sizeof(arch) / sizeof(void*);
n--;
}
ft_memcpy(&sub_file_info, file_info, sizeof(t_file_info));
sub_file_info.data = file_info->data + swapuint32_t(offset);
process_file(&sub_file_info, FALSE);
}