当前位置: 首页>>代码示例>>C++>>正文


C++ print_output函数代码示例

本文整理汇总了C++中print_output函数的典型用法代码示例。如果您正苦于以下问题:C++ print_output函数的具体用法?C++ print_output怎么用?C++ print_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了print_output函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv) {
    char *arg;

    char *address = NULL;
    char *language = NULL;

    bool use_json = false;

    string_array *languages = NULL;

    for (int i = 1; i < argc; i++) {
        arg = argv[i];
        if (string_equals(arg, "-h") || string_equals(arg, "--help")) {
            printf(LIBPOSTAL_USAGE);
            exit(EXIT_SUCCESS);
        } else if (string_equals(arg, "--json")) {
            use_json = true;
        } else if (address == NULL) {
            address = arg;
        } else if (!string_starts_with(arg, "-")) {
            if (languages == NULL) {
                languages = string_array_new();
            }
            string_array_push(languages, arg);
        }
    }

    if (address == NULL && (!use_json || isatty(fileno(stdin)))) {
        log_error(LIBPOSTAL_USAGE);
        exit(EXIT_FAILURE);
    }

    if (!libpostal_setup() || (languages == NULL && !libpostal_setup_language_classifier())) {
        exit(EXIT_FAILURE);
    }

    normalize_options_t options = get_libpostal_default_options();

    if (languages != NULL) {
        options.languages = languages->a;
        options.num_languages = languages->n;
    }

    if (address == NULL) {
        char *line;
        while ((line = file_getline(stdin)) != NULL) {
            print_output(line, options, use_json);
            free(line);
        }
    } else {
        print_output(address, options, use_json);
    }

    if (languages != NULL) {
        string_array_destroy(languages);
    }

    libpostal_teardown();
    libpostal_teardown_language_classifier();
}
开发者ID:AbhiAbhi21,项目名称:libpostal,代码行数:60,代码来源:main.c

示例2: main

int main(int argc, char *argv[], char *envp[]) {
  int option;
  int i;
  bool newline;
  char **ep;
  char *temp;

  newline = true;

  while((option = getopt(argc, argv, "0h")) != -1) {
    switch(option) {
      case '0': newline = false;
                break;
      case 'h': print_usage();
      default: err_exit("Try 'printenv -h' for more information.\n");
    }
  }

  if(optind == argc) {
    for(ep = envp; *ep != NULL; ep++) {
      print_output(newline, *ep);
    }
  } else {
    for(i = optind; i < argc; i++) {
      temp = getenv(argv[i]);
      if(temp != NULL) {
        print_output(newline, temp);
      }
    }
  }

  exit(EXIT_SUCCESS);
}
开发者ID:chaitanyav,项目名称:cprograms,代码行数:33,代码来源:printenv.c

示例3: open_output

void open_output(ofstream& outputfile, ofstream& errorfile,
                 string outputfilename) {
    
    outputfile.open(outputfilename.c_str());
    if (!outputfile.is_open()) {
        
        print_output(errorfile, cout, "Cannot open input file: ");
        print_output(errorfile, cout, outputfilename);
        print_output(errorfile, cout, "\n");
        
        exit(1);
    }
}
开发者ID:Naeemkh,项目名称:Homework8,代码行数:13,代码来源:io_print_handler.cpp

示例4: main

int main(void){
	int x = get_input();
	int y = compute(x);
	print_output(y);

	return 0;
}
开发者ID:hist0613,项目名称:private_lesson,代码行数:7,代码来源:lecture57.c

示例5: main

int main(int argc,char *argv[])
{
	srand(time(NULL));
	int gen_no,tra_no;
	vote_t *votes=parse_input(&gen_no,&tra_no);
	int loy_no=gen_no-tra_no;
	print_input(gen_no,loy_no,tra_no,votes);
	mb_t *mbs=create_mailboxes(gen_no+1);
	mbi_t *mbis=mailbox_addresses(mbs,gen_no+1);
	mbo_t mbo=mbs[0].mbo;
	role_t *roles=init_roles(gen_no,tra_no);
	gen_t *gens=create_generals(roles,mbs,mbis,gen_no,tra_no,votes);
	sig_t sig=getpid();
	int rounds=max_traitors(gen_no)+1;
	for(int round=1;round<=rounds;round++)
	{
		sync_phase_wait(mbo,gen_no);
		print_round(round,rounds);
		print_phase(1,3);
		sync_phase_signal(mbis,sig,gen_no);
		sync_phase_wait(mbo,gen_no);
		print_phase(2,3);
		sync_phase_signal(mbis,sig,gen_no);
		sync_phase_wait(mbo,gen_no);
		print_phase(3,3);
		sync_phase_signal(mbis,sig,gen_no);
	}
	votes=get_final_votes(mbo,loy_no);
	print_output(loy_no,votes);
	free(votes);
	destroy_mailboxes(mbs,gen_no+1);
	free(mbs); free(mbis);
	free(gens); free(roles);
	return 0;
}
开发者ID:Renelvon,项目名称:consensus,代码行数:35,代码来源:simul.c

示例6: main

/*** main
*
***/
int main(int argc, char **argv)
{
	FILE *input;
	FILE *output;
	struct instruction *inst = NULL; //initializing the instruction list
	if(argc == 1) //if argc is 1, that means that only the executable name is specified and there's no input or output files 
	{
		printf("Error: No file specified\n");
	}
	else if(argc == 2) //if argc is 2, that means that only the executable name and input file are specified 
	{
		printf("Error: no output file specified\n");
	}
	else if (argc == 3) //if argc is 3, we're good to go
	{
		input = fopen(argv[1], "r"); //open the input file for reading
		output = fopen(argv[2], "w"); //open the output file for writing 
		inst = set_label_addresses(inst, input); //cycle through the input file and look for labels and note their memory addresses. 
		fclose(input); //close the input file and re-open it to go through the main processing loop
		input = fopen(argv[1], "r");
		inst = process_file(inst, input); 
		print_output(inst, output); //write to the ouput file
		fclose(input);
		fclose(output);
	}
	else //if argc is over 3, then there are too many arguments
	{
		printf("Error: Too many arguments passed to assembler\n");
	}
	return 0;
}
开发者ID:jnethery,项目名称:MIPS_Simulator,代码行数:34,代码来源:assembler.c

示例7: main

//********************************************************************
// Main Functions
//********************************************************************
void main(void) { //Main function
    Sys_Init(); // initialize board
    putchar(' '); //the quotes in this line may not format correctly
    Port_Init();//Init ports
    XBR0_Init();//init xbro
    PCA_Init();//init pca
    SMB_Init();//init smb
    printf("\r\n\n\n\nEmbedded Control Electric Compass and Ranger\n"); //print beginning message

    Calibration();//Run calibration
	comp_cal();	//Compass calibration
    Choose_heading();	//Heading choice 
	printf("\r\nheading error");
	while(1) {	//inf loop, 40 ms it returns the heading	

		if (new_heading){	//enough overflows for a new heading COMPASS STUFF
			new_heading = 0;//Clear new_heading
			heading = ReadCompass();	//get compass heading	
			Steering_Servo();	//run steer func
		}//end if new heading
		
		if (new_range) { //if 80 ms has passed
			new_range=0;//Clear new_range
			range=ReadRanger();//read ranger
			start_ping();//start ping
			counts++;//set up text function
			Drive_Motor();	//run drive func
		}//end if new_range

		if (counts == 3){	//prevoudly output prined every 200 ms, now every 180 ms
			print_output();//Print data function. Delete this if faster output is desired
		}//end if counts
	}//end inf while
}//end main
开发者ID:PhilipHoddinott,项目名称:LightTechs,代码行数:37,代码来源:LAB3_3_FINAL.c

示例8: matchfun

int
matchfun(unsigned char *buf,
	 size_t len,
	 size_t pos,
	 void *misc)
{
    char *pathname = (char *) misc;
    
    pthread_mutex_lock(&matches_lock);
    ++n_matches;
    pthread_mutex_unlock(&matches_lock);

    if (line_f)
	while (pos > 0 &&
	       !(buf[pos-1] == '\n' || buf[pos-1] == '\r'))
	    --pos;
    
    pthread_mutex_lock(&print_lock);
    
    printf("%s : %lu : ", pathname, (unsigned long) pos);
    print_output(buf+pos, len-pos);
    putchar('\n');
    
    pthread_mutex_unlock(&print_lock);
    return 0;
}
开发者ID:panglong,项目名称:concurrit,代码行数:26,代码来源:pfscan.c

示例9: main

/* -------------------------------------------------------------
// ------   MAIN - replace this by your own aplication! 
// ------------------------------------------------------------- */
int main(int argn, char *argv[]) {
  int multipnm=1;
  job_t job;

  JOB = &job;
  setvbuf(stdout, (char *) NULL, _IONBF, 0);	/* not buffered */
  
  while (multipnm==1) {

    job_init(&job);
  
    process_arguments(&job, argn, argv);

    mark_start(&job);

    multipnm = read_picture(&job);
    /* separation of main and rest for using as lib
       this will be changed later => introduction of set_option()
       for better communication to the engine  */
    if (multipnm<0) break; /* read error */
  
    /* call main loop */
    pgm2asc(&job);

    mark_end(&job);
  
    print_output(&job);

    job_free(&job);
  
  }
  
  return 0;
}
开发者ID:cyb3727,项目名称:annrecognition,代码行数:37,代码来源:gocr.c

示例10: report

void Node::reportMessage(int weight, int j) {
  if(j != this->parent){
    if(weight < this->bestWeight){
      this->bestEdge = j;
      this->bestWeight = weight;
    }
    this->findCount += 1;
    report();
  }
  else{ 
    if(this->state == 1){
      message msg;
      msg.id = 5;
      msg.args[0]=weight;
      msg.weight = this->edges[j].weight;
      //place recieved message at queue end
      this->addMessage(msg);
    }
    else if(weight > this->bestWeight){
      changeRoot();
    }
    else if (weight == INF && this->bestWeight == INF){
      print_output();
      run = 0;
      //pthread_exit(NULL);
    }
  }
}	
开发者ID:sawrubh,项目名称:ghs,代码行数:28,代码来源:node.cpp

示例11: main

int main(void){
  int time, hour, minute, second;
  
  input(&time);
  distribution(time, &hour, &minute, &second);
  print_output(time, hour, minute, second); 
}
开发者ID:thducng,项目名称:C,代码行数:7,代码来源:AOP2_upgrade.c

示例12: print_output_verbose

/**
 * Print a bit more verbose information about outgoing data to stdout.
 * @param to Pointer to the address of the peer.
 * @param len Number of bytes sent.
 * @param ppid PPID set for the outgoing packet
 * @param streamno Number for the stream where the output was sent.
 */
void print_output_verbose( struct sockaddr_storage *to, int len,
                uint32_t ppid, uint16_t streamno)
{
        print_output(to,len);
        printf("\t stream: %d ppid: %d\n",
                        streamno, ppid);
}
开发者ID:BillTheBest,项目名称:sctp-tools,代码行数:14,代码来源:common.c

示例13: missing_key_error

static void missing_key_error(const std::string & file, int line,
					 const std::string & tag,const std::string & key,
					 bool flag_exception){
	std::ostringstream ss;
	ss << "Missing key '" << key << "=' in tag [" << tag
	   << "]\n"
	   << at(file, line) << "\n";
	print_output (ss.str (),flag_exception);
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:9,代码来源:schema_validator.cpp

示例14: extra_tag_error

static void extra_tag_error(const std::string & file, int line,
							const std::string & name,int n,
							const std::string & parent, bool flag_exception){
	std::ostringstream ss;
	ss << "Extra tag [" << name << "]; there may only be "
	   << n << " [" << name << "] in [" << parent << "]\n"
	   << at(file, line) << "\n";
	print_output (ss.str (),flag_exception);
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:9,代码来源:schema_validator.cpp

示例15: lua_gettop

bool CScriptStorage::do_file	(LPCSTR caScriptName, LPCSTR caNameSpaceName)
{
	int				start = lua_gettop(lua());
	string_path		l_caLuaFileName;
	IReader			*l_tpFileReader = FS.r_open(caScriptName);
	if (!l_tpFileReader) {
		script_log	(eLuaMessageTypeError,"Cannot open file \"%s\"",caScriptName);
		return		(false);
	}
	strconcat		(sizeof(l_caLuaFileName),l_caLuaFileName,"@",caScriptName);
	
	if (!load_buffer(lua(),static_cast<LPCSTR>(l_tpFileReader->pointer()),(size_t)l_tpFileReader->length(),l_caLuaFileName,caNameSpaceName)) {
//		VERIFY		(lua_gettop(lua()) >= 4);
//		lua_pop		(lua(),4);
//		VERIFY		(lua_gettop(lua()) == start - 3);
		lua_settop	(lua(),start);
		FS.r_close	(l_tpFileReader);
		return		(false);
	}
	FS.r_close		(l_tpFileReader);

	int errFuncId = -1;
#ifdef USE_DEBUGGER
#	ifndef USE_LUA_STUDIO
		if( ai().script_engine().debugger() )
			errFuncId = ai().script_engine().debugger()->PrepareLua(lua());
#	endif // #ifndef USE_LUA_STUDIO
#endif // #ifdef USE_DEBUGGER
	if (0)	//.
	{
	    for (int i=0; lua_type(lua(), -i-1); i++)
            Msg	("%2d : %s",-i-1,lua_typename(lua(), lua_type(lua(), -i-1)));
	}

	// because that's the first and the only call of the main chunk - there is no point to compile it
//	luaJIT_setmode	(lua(),0,LUAJIT_MODE_ENGINE|LUAJIT_MODE_OFF);						// Oles
	int	l_iErrorCode = lua_pcall(lua(),0,0,(-1==errFuncId)?0:errFuncId);				// new_Andy
//	luaJIT_setmode	(lua(),0,LUAJIT_MODE_ENGINE|LUAJIT_MODE_ON);						// Oles

#ifdef USE_DEBUGGER
#	ifndef USE_LUA_STUDIO
		if( ai().script_engine().debugger() )
			ai().script_engine().debugger()->UnPrepareLua(lua(),errFuncId);
#	endif // #ifndef USE_LUA_STUDIO
#endif // #ifdef USE_DEBUGGER
	if (l_iErrorCode) {
#ifdef DEBUG
		print_output(lua(),caScriptName,l_iErrorCode);
#endif
		on_error	(lua());
		lua_settop	(lua(),start);
		return		(false);
	}

	return			(true);
}
开发者ID:2asoft,项目名称:xray,代码行数:56,代码来源:script_storage.cpp


注:本文中的print_output函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。