这篇教程C++ update_file函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中update_file函数的典型用法代码示例。如果您正苦于以下问题:C++ update_file函数的具体用法?C++ update_file怎么用?C++ update_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了update_file函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: conflict_rename_rename_2static void conflict_rename_rename_2(struct rename *ren1, const char *branch1, struct rename *ren2, const char *branch2){ char *new_path1 = unique_path(ren1->pair->two->path, branch1); char *new_path2 = unique_path(ren2->pair->two->path, branch2); output(1, "Renamed %s to %s and %s to %s instead", ren1->pair->one->path, new_path1, ren2->pair->one->path, new_path2); remove_file(0, ren1->pair->two->path, 0); update_file(0, ren1->pair->two->sha1, ren1->pair->two->mode, new_path1); update_file(0, ren2->pair->two->sha1, ren2->pair->two->mode, new_path2); free(new_path2); free(new_path1);}
开发者ID:Pistos,项目名称:git,代码行数:16,
示例2: cpu_system_funcdouble cpu_system_func ( void ) { char *p; double val; double last_system_jiffies, system_jiffies, last_total_jiffies, total_jiffies, diff; p = update_file(&proc_stat); p = skip_token(p); p = skip_token(p); p = skip_token(p); system_jiffies = strtod( p , (char **)NULL ); if (num_cpustates > NUM_CPUSTATES_24X) { p = skip_token(p); p = skip_token(p); p = skip_token(p); system_jiffies += strtod( p , (char **)NULL ); /* "intr" counted in system */ p = skip_token(p); system_jiffies += strtod( p , (char **)NULL ); /* "sintr" counted in system */ } total_jiffies = total_jiffies_func(); diff = system_jiffies - last_system_jiffies; if ( diff ) val = (diff/(total_jiffies - last_total_jiffies))*100; else val = 0.0; last_system_jiffies = system_jiffies; last_total_jiffies = total_jiffies; return val;}
开发者ID:imaxxs,项目名称:cyton,代码行数:33,
示例3: update_cnstatstatic int update_cnstat(uint32_t udp, uint32_t tcp, uint32_t other){ char path[1024]; struct stat s; struct conn_entry e; snprintf(path, sizeof(path), DB_CN_FILE); if (stat(path, &s)) { if (init_file(path, sizeof(struct conn_entry))) { fprintf(stderr, "Failed to init %s: %s/n", path, strerror(errno)); return -1; } } e.time = htonl(time(NULL)); e.udp = htonl(udp); e.tcp = htonl(tcp); e.other = htonl(other); return update_file(path, &e, sizeof(struct conn_entry));}
开发者ID:IoveSunny,项目名称:DreamBox,代码行数:27,
示例4: update_ldstatstatic int update_ldstat(uint16_t load1, uint16_t load5, uint16_t load15){ char path[1024]; struct stat s; struct load_entry e; snprintf(path, sizeof(path), DB_LD_FILE); if (stat(path, &s)) { if (init_file(path, sizeof(struct load_entry))) { fprintf(stderr, "Failed to init %s: %s/n", path, strerror(errno)); return -1; } } e.time = htonl(time(NULL)); e.load1 = htons(load1); e.load5 = htons(load5); e.load15 = htons(load15); return update_file(path, &e, sizeof(struct load_entry));}
开发者ID:IoveSunny,项目名称:DreamBox,代码行数:27,
示例5: update_ifstatstatic int update_ifstat( const char *ifname, uint32_t rxb, uint32_t rxp, uint32_t txb, uint32_t txp) { char path[1024]; struct stat s; struct traffic_entry e; snprintf(path, sizeof(path), DB_IF_FILE, ifname); if (stat(path, &s)) { if (init_file(path, sizeof(struct traffic_entry))) { fprintf(stderr, "Failed to init %s: %s/n", path, strerror(errno)); return -1; } } e.time = htonl(time(NULL)); e.rxb = htonl(rxb); e.rxp = htonl(rxp); e.txb = htonl(txb); e.txp = htonl(txp); return update_file(path, &e, sizeof(struct traffic_entry));}
开发者ID:IoveSunny,项目名称:DreamBox,代码行数:29,
示例6: update_radiostatstatic int update_radiostat( const char *ifname, uint16_t rate, uint8_t rssi, uint8_t noise) { char path[1024]; struct stat s; struct radio_entry e; snprintf(path, sizeof(path), DB_RD_FILE, ifname); if (stat(path, &s)) { if (init_file(path, sizeof(struct radio_entry))) { fprintf(stderr, "Failed to init %s: %s/n", path, strerror(errno)); return -1; } } e.time = htonl(time(NULL)); e.rate = htons(rate); e.rssi = rssi; e.noise = noise; return update_file(path, &e, sizeof(struct radio_entry));}
开发者ID:IoveSunny,项目名称:DreamBox,代码行数:28,
示例7: debugchar *select_strategy(const char *msg) { int deep = 1; debug(deep, "Received string: '%s'", msg); info(deep, "Select strategy"); unsigned char action = msg[0]; char *result; switch (action) { case COMMAND_CREATE: append_strings("", create_file(msg), &result); break; case COMMAND_UPDATE: append_strings("", update_file(msg), &result); break; case COMMAND_DELETE: append_strings("", delete_file(msg), &result); break; case COMMAND_READ: result = read_file(msg); break; case COMMAND_LIST: result = list_files(msg); break; default: append_strings("", ANSWER_UNKOWN, &result); error(deep, "Wrong action %c", action); } info(deep, "Return value: '%s'", result); return result;}
开发者ID:jorgemtnz,项目名称:simpleFileServer,代码行数:31,
示例8: update_each_filestatic voidupdate_each_file (gpointer key, gpointer unused, gpointer data){ UpdateDescendants *ctx = (UpdateDescendants*)data; if (update_file (ctx->tracker, FALSE, key)) g_hash_table_remove (ctx->checks, key);}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:7,
示例9: dofile/** * @brief ... * @param filename */void dofile(char *filename){ struct stat statbuf; currentfile = filename; /* Checks if this is a tex file */ det_tflag(filename); det_defdupchar(filename); if ((infile = fopen(filename, "r")) == NULL) { fprintf(stderr, CANT_OPEN, filename); sleep((unsigned) 2); return; } det_readonly_access(filename); open_outfile(&statbuf); quit = 0; changes = 0; checkfile(); fclose(infile); fclose(outfile); if (!cflag) treeoutput(); if (changes && !readonly) update_file(filename, &statbuf); unlink(tempfile);}
开发者ID:gitpan,项目名称:Lingua-Jspell,代码行数:38,
示例10: inst_bookvoid inst_book(char *student_id) { int c; char buff[100]; struct tm tim; time_t now= time(0); tim= *(localtime(&now)); strftime (buff, 100, "%d/%m/%Y %H:%M:%S", &tim); initscr(); mvprintw(0,40,buff); c= get_comp(student_id,tim.tm_hour,tim.tm_min,1); if(c==0) mvprintw(9,10,"Sorry! All computers booked at the moment"); else { tim.tm_hour ++; strftime (buff, 100, "%d/%m/%Y %H:%M:%S", &tim); mvprintw(9,10,"Successfully booked comp_id = %d under user_id /"%s/"/n/t/tuptill %s",c,student_id,buff); } refresh(); if(!get_confirm()) return; if(c!=0) update_file(c,student_id,tim.tm_hour-1,tim.tm_min,1);}
开发者ID:NikethReddy,项目名称:Login_Systems,代码行数:25,
示例11: emit_code_defsstatic intemit_code_defs(const char *to){ const char *tmp = "vmi.tmp"; FILE *out = fopen(tmp, "w"); int i; fprintf(out, "/* File: %s/n/n", to); fprintf(out, " This file provides the definition of type code./n"); fprintf(out, "/n"); fprintf(out, " Note: this file is generated by %s from %s. DO NOT EDIT", program, vmi_file); fprintf(out, " /n"); fprintf(out, "*//n/n"); fprintf(out, "typedef enum/n"); fprintf(out, "{/n"); for(i=0; i<vmi_count; i++) { fprintf(out, " %s,/n", vmi_list[i].name); } fprintf(out, " VMI_END_LIST/n"); fprintf(out, "} vmi;/n/n"); fprintf(out, "#define I_HIGHEST ((int)VMI_END_LIST)/n"); fprintf(out, "#define VM_SIGNATURE 0x%x/n", MurmurHashAligned2(synopsis, syn_size, 0x12345678)); fclose(out); return update_file(tmp, to);}
开发者ID:AaronZhangL,项目名称:swipl-devel,代码行数:30,
示例12: num_cpustates_funcunsigned intnum_cpustates_func ( void ){ char *p; unsigned int i=0; proc_stat.last_read.tv_sec=0; proc_stat.last_read.tv_usec=0; p = update_file(&proc_stat); proc_stat.last_read.tv_sec=0; proc_stat.last_read.tv_usec=0;/*** Skip initial "cpu" token*/ p = skip_token(p); p = skip_whitespace(p);/*** Loop over file until next "cpu" token is found.** i=4 : Linux 2.4.x** i=7 : Linux 2.6.x*/ while (strncmp(p,"cpu",3)) { p = skip_token(p); p = skip_whitespace(p); i++; } return i;}
开发者ID:ganglia,项目名称:ganglia-modules-linux,代码行数:30,
示例13: mainintmain (int argc, char **argv){ int ch, executable_stack = 0, recovery_code = 0; extern int optind; prog_name = argv[0]; if (argc < 2) { usage (stderr); exit (-1); } while (1) { ch = getopt_long (argc, argv, "eErRh", long_options, NULL); if (ch == -1) break; switch (ch) { case 'e': executable_stack = -1; break; case 'E': executable_stack = 1; break; case 'r': recovery_code = -1; break; case 'R': recovery_code = 1; break; case 'h': usage (stdout); exit (0); } } while (optind < argc) update_file (argv[optind++], executable_stack, recovery_code); return 0;}
开发者ID:invisibleboy,项目名称:mycompiler,代码行数:35,
示例14: total_jiffies_func/* * A helper function to return the total number of cpu jiffies */JTtotal_jiffies_func ( void ){ char *p; JT user_jiffies, nice_jiffies, system_jiffies, idle_jiffies, wio_jiffies, irq_jiffies, sirq_jiffies; p = update_file(&proc_stat); p = skip_token(p); p = skip_whitespace(p); user_jiffies = strtod( p, &p ); p = skip_whitespace(p); nice_jiffies = strtod( p, &p ); p = skip_whitespace(p); system_jiffies = strtod( p, &p ); p = skip_whitespace(p); idle_jiffies = strtod( p, &p ); if(num_cpustates == NUM_CPUSTATES_24X) return user_jiffies + nice_jiffies + system_jiffies + idle_jiffies; p = skip_whitespace(p); wio_jiffies = strtod( p, &p ); p = skip_whitespace(p); irq_jiffies = strtod( p, &p ); p = skip_whitespace(p); sirq_jiffies = strtod( p, &p ); return user_jiffies + nice_jiffies + system_jiffies + idle_jiffies + wio_jiffies + irq_jiffies + sirq_jiffies;}
开发者ID:bdbaddog,项目名称:monitor-core,代码行数:34,
示例15: cpu_idle_funcg_val_tcpu_idle_func ( void ){ char *p; static g_val_t val; static struct timeval stamp={0, 0}; static JT last_idle_jiffies, idle_jiffies, last_total_jiffies, total_jiffies, diff; p = update_file(&proc_stat); if((proc_stat.last_read.tv_sec != stamp.tv_sec) && (proc_stat.last_read.tv_usec != stamp.tv_usec)) { stamp = proc_stat.last_read; p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); idle_jiffies = strtod( p , (char **)NULL ); total_jiffies = total_jiffies_func(); diff = idle_jiffies - last_idle_jiffies; if ( diff ) val.f = ((double)diff/(double)(total_jiffies - last_total_jiffies)) * 100.0; else val.f = 0.0; last_idle_jiffies = idle_jiffies; last_total_jiffies = total_jiffies; } return val;}
开发者ID:HC-ITOPS,项目名称:monitor-core,代码行数:35,
示例16: cpu_nice_funcg_val_tcpu_nice_func ( void ){ char *p; static g_val_t val; static struct timeval stamp={0, 0}; static JT last_nice_jiffies, nice_jiffies, last_total_jiffies, total_jiffies, diff; p = update_file(&proc_stat); if((proc_stat.last_read.tv_sec != stamp.tv_sec) && (proc_stat.last_read.tv_usec != stamp.tv_usec)) { stamp = proc_stat.last_read; p = skip_token(p); p = skip_token(p); nice_jiffies = strtod( p , (char **)NULL ); total_jiffies = total_jiffies_func(); diff = (nice_jiffies - last_nice_jiffies); if ( diff ) val.f = ((double)diff/(double)(total_jiffies - last_total_jiffies)) * 100.0; else val.f = 0.0; val.f = sanityCheck( __LINE__, __FILE__, __FUNCTION__, val.f, (double)diff, (double)(total_jiffies - last_total_jiffies), nice_jiffies, last_nice_jiffies, total_jiffies, last_total_jiffies ); last_nice_jiffies = nice_jiffies; last_total_jiffies = total_jiffies; } return val;}
开发者ID:BDA-CODE,项目名称:monitor-core,代码行数:34,
示例17: multi_cpu_sintr_funcstatic g_val_t multi_cpu_sintr_func (int cpu_index){ char *p; cpu_util *cpu = &(cpu_sintr[cpu_index]); if (num_cpustates == NUM_CPUSTATES_24X) { cpu->val.f = 0.; return cpu->val; } p = update_file(&proc_stat); if((proc_stat.last_read.tv_sec != cpu->stamp.tv_sec) && (proc_stat.last_read.tv_usec != cpu->stamp.tv_usec)) { cpu->stamp = proc_stat.last_read; p = find_cpu (p, cpu_index, &cpu->curr_total_jiffies); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_whitespace(p); calculate_utilization (p, cpu); } return cpu->val;}
开发者ID:simplegeo,项目名称:ganglia,代码行数:29,
示例18: cpu_idle_funcg_val_t cpu_idle_func ( void ){ char *p; static g_val_t val; static int stamp; static double last_idle_jiffies, idle_jiffies, last_total_jiffies, total_jiffies, diff; p = update_file(&proc_stat); if(proc_stat.last_read != stamp) { stamp = proc_stat.last_read; p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); idle_jiffies = strtod( p , (char **)NULL ); total_jiffies = total_jiffies_func(); diff = idle_jiffies - last_idle_jiffies; if ( diff ) val.f = (diff/(total_jiffies - last_total_jiffies))*100; else val.f = 0.0; last_idle_jiffies = idle_jiffies; last_total_jiffies = total_jiffies; } return val;}
开发者ID:colama,项目名称:colama-3rdparty-tools,代码行数:34,
示例19: local_system_void repository::distributor::update_meta(const entry &package) { try { BUNSAN_LOG_DEBUG << "Starting /"" << package << "/" " << __func__; const tempfile checksum_tmp = local_system_().small_tempfile(); try { m_fetcher->fetch(checksum_url(package), checksum_tmp.path()); } catch (std::exception &) { BOOST_THROW_EXCEPTION( distributor_update_meta_no_package_error() << distributor_update_meta_no_package_error::path(checksum_tmp.path()) << distributor_update_meta_no_package_error::message( "Unable to fetch checksum") << enable_nested_current()); } boost::filesystem::copy_file( checksum_tmp.path(), cache_().checksum_path(package), boost::filesystem::copy_option::overwrite_if_exists); update_file(index_url(package), cache_().index_path(package), // /pre index is treated like regular source cache_().read_checksum(package).at(format().name.get_index())); } catch (std::exception &) { BOOST_THROW_EXCEPTION(distributor_update_meta_error() << distributor_update_meta_error::package(package) << enable_nested_current()); }}
开发者ID:bunsanorg,项目名称:pm,代码行数:25,
示例20: cpu_idle_funcdouble cpu_idle_func ( void ) { char *p; static double val; static double last_idle_jiffies, idle_jiffies, last_total_jiffies, total_jiffies, diff; p = update_file(&proc_stat); p = skip_token(p); p = skip_token(p); p = skip_token(p); p = skip_token(p); idle_jiffies = strtod( p , (char **)NULL ); total_jiffies = total_jiffies_func(); diff = idle_jiffies - last_idle_jiffies; if ( diff ) val = (diff/(total_jiffies - last_total_jiffies))*100; else val = 0.0; last_idle_jiffies = idle_jiffies; last_total_jiffies = total_jiffies; return val; }
开发者ID:imaxxs,项目名称:cyton,代码行数:25,
示例21: readFile// sorting itemcode are calculated herevoid Inventory::sortItem_code(ingredient inventory[]){ x = readFile(); for( int i = 1; i <= x; ++i ) { while( inventory[i].itemcode < inventory[i-1].itemcode ) { // swapping the item so that the lowest is at the top swap( inventory[i].itemcode, inventory[i-1].itemcode ); swap( inventory[i].perPrice, inventory[i-1].perPrice ); swap( inventory[i].itemName, inventory[i-1].itemName ); swap( inventory[i].intrQty, inventory[i-1].intrQty ); // see predefined function above --i; if( !i ) break; } } system("cls"); cout << "Sorted by Itemcode" << endl; bar(); printInventory(inventory, x); update_file(); cout << "/n/nPress any key to continue..."; getch(); menuDisplay();}
开发者ID:ChrisTiller,项目名称:RestaurantManagement,代码行数:30,
示例22: emit_jump_tablestatic intemit_jump_table(const char *to){ const char *tmp = "vmi.tmp"; FILE *out = fopen(tmp, "w"); int i; fprintf(out, "/* File: %s/n/n", to); fprintf(out, " This file provides the GCC-2 jump-labels to exploit GCC's/n"); fprintf(out, " support for threaded code./n"); fprintf(out, "/n"); fprintf(out, " Note: this file is generated by %s from %s. DO NOT EDIT", program, vmi_file); fprintf(out, " /n"); fprintf(out, "*//n/n"); fprintf(out, "static void *jmp_table[] =/n"); fprintf(out, "{/n"); for(i=0; i<vmi_count; i++) { fprintf(out, " &&%s_LBL,/n", vmi_list[i].name); } fprintf(out, " NULL/n"); fprintf(out, "};/n"); fclose(out); return update_file(tmp, to);}
开发者ID:AaronZhangL,项目名称:swipl-devel,代码行数:29,
示例23: load_one_funcg_val_tload_one_func ( void ){ g_val_t val; val.f = strtod( update_file(&proc_loadavg), (char **)NULL); return val;}
开发者ID:bdbaddog,项目名称:monitor-core,代码行数:9,
示例24: conflict_rename_dirstatic void conflict_rename_dir(struct merge_options *o, struct rename *ren1, const char *branch1){ char *new_path = unique_path(o, ren1->pair->two->path, branch1); output(o, 1, "Renaming %s to %s instead", ren1->pair->one->path, new_path); remove_file(o, 0, ren1->pair->two->path, 0); update_file(o, 0, ren1->pair->two->sha1, ren1->pair->two->mode, new_path); free(new_path);}
开发者ID:emk,项目名称:git,代码行数:10,
示例25: do_child_loop //子进程写文件 void do_child_loop(int sem_set_id, char* file_name) { pid_t pid = getpid(); int i, j; for (i=0; i<3; i++) { update_file(sem_set_id, file_name, pid); for (j=0; j<400000; j++) ; } }
开发者ID:alannet,项目名称:example,代码行数:11,
示例26: counter_staffint counter_staff(int no_staff) /*Recursion function*/{ while(no_staff>0) { staff=enter_staff_data(staff); update_file(staff); return counter_staff(no_staff-1); } return 0;}
开发者ID:nurul98,项目名称:ITMS_Staff_System,代码行数:10,
示例27: load_five_funcdouble load_five_func ( void ) { char *p; double val; p = update_file(&proc_loadavg); p = skip_token(p); val = strtod( p, (char **)NULL); return val;}
开发者ID:imaxxs,项目名称:cyton,代码行数:10,
示例28: metric_init/* * This function is called only once by the gmond. Use to * initialize data structures, etc or just return SYNAPSE_SUCCESS; */g_val_tmetric_init(void){ g_val_t rval; char * dummy; struct stat struct_stat; num_cpustates = num_cpustates_func(); /* scaling_max_freq will contain the max CPU speed if available */ cpufreq = 0; if ( stat(SCALING_MAX_FREQ, &struct_stat) == 0 ) { cpufreq = 1; dummy = sys_devices_system_cpu; slurpfile(SCALING_MAX_FREQ, &dummy, 32); } dummy = proc_cpuinfo; rval.int32 = slurpfile("/proc/cpuinfo", &dummy, BUFFSIZE); if (proc_cpuinfo == NULL) proc_cpuinfo = dummy; if ( rval.int32 == SLURP_FAILURE ) { err_msg("metric_init() got an error from slurpfile() /proc/cpuinfo"); rval.int32 = SYNAPSE_FAILURE; return rval; } dummy = proc_sys_kernel_osrelease; rval.int32 = slurpfile("/proc/sys/kernel/osrelease", &dummy, MAX_G_STRING_SIZE); if ( rval.int32 == SLURP_FAILURE ) { err_msg("metric_init() got an error from slurpfile()"); rval.int32 = SYNAPSE_FAILURE; return rval; } /* Get rid of pesky /n in osrelease */ proc_sys_kernel_osrelease[rval.int32-1] = '/0'; dummy = update_file(&proc_net_dev); if ( dummy == NULL ) { err_msg("metric_init() got an error from update_file()"); rval.int32 = SYNAPSE_FAILURE; return rval; } update_ifdata("metric_inint"); rval.int32 = SYNAPSE_SUCCESS; return rval;}
开发者ID:HC-ITOPS,项目名称:monitor-core,代码行数:59,
示例29: handle_delete_modifystatic void handle_delete_modify(struct merge_options *o, const char *path, const char *new_path, unsigned char *a_sha, int a_mode, unsigned char *b_sha, int b_mode){ /* Only need to checkout other's version if I deleted the file. */ if (!a_sha) { update_file(o, 0, b_sha, b_mode, new_path); }}
开发者ID:asukaliy,项目名称:seafile,代码行数:11,
示例30: load_five_funcg_val_tload_five_func ( void ){ char *p; g_val_t val; p = update_file(&proc_loadavg); p = skip_token(p); val.f = strtod(p, (char **)NULL); return val;}
开发者ID:bdbaddog,项目名称:monitor-core,代码行数:12,
注:本文中的update_file函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ update_fpu_flags函数代码示例 C++ update_events函数代码示例 |