本文整理汇总了C++中check_file函数的典型用法代码示例。如果您正苦于以下问题:C++ check_file函数的具体用法?C++ check_file怎么用?C++ check_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: read_out
void read_out()
{
int k=0;
FILE *fopen(),*fp;
int count;
fp=fopen("database.txt","r");
if(check_file(fp)==0){printf("Problem reading the file SLOTS_BEST_productN.txt, have you created it yet?\r\n");}
else
{
count=getc(fp);
while(count!=EOF)
{
count=getc(fp);
putchar(count);
}
}//open the file and put the characters onto the screen
fclose(fp);
wait_for_user();
}
开发者ID:eokeeffe,项目名称:C-code,代码行数:20,代码来源:question7.c
示例2: run_bst_del
void run_bst_del(char *file, std::vector<char *> & strvec)
{
if (FALSE == check_file(file)) {
exit(1);
}
ifstream fin(file);
if (!fin.good()) {
cerr << "read file: " << file << " failed.\n";
exit(1);
}
Bst bst(fin);
bst.build();
for (size_t i=0; i< strvec.size(); i++) {
cout << "\nDeleted \""<< strvec[i] << "\":\n\n";
bst.del(strvec[i]);
bst.display();
}
}
开发者ID:zhoujun06,项目名称:usc_cs570,代码行数:20,代码来源:main.cpp
示例3: Command_load
int Command_load(Command *cmd)
{
bstring db_file = option(cmd, "db", "config.sqlite");
bstring conf_file = option(cmd, "config", "mongrel2.conf");
bstring what = NULL;
bstring why = NULL;
check_file(conf_file, "config file", R_OK);
Config_load(bdata(conf_file), bdata(db_file));
what = bfromcstr("load");
why = bfromcstr("command");
log_action(db_file, what, why, NULL, conf_file);
error: // fallthrough
bdestroy(what);
bdestroy(why);
return 0;
}
开发者ID:304471720,项目名称:mongrel2,代码行数:20,代码来源:config.c
示例4: check_directory
int check_directory(const char* dirpath)
{
int num_error = 0;
std::vector<std::string>* subdir_names = NULL;
std::vector<std::string> file_names;
std::vector<std::string>* link_names = NULL;
mooon::sys::CDirUtils::list(dirpath, subdir_names, &file_names, link_names);
for (std::vector<std::string>::size_type i=0; i<file_names.size(); ++i)
{
if (mooon::db_proxy::is_sql_log_filename(file_names[i]))
{
const std::string filepath = mooon::utils::CStringUtils::format_string("%s/%s", dirpath, file_names[i].c_str());
if (check_file(filepath.c_str()) != 0)
++num_error;
}
}
return 0 == num_error;
}
开发者ID:eyjian,项目名称:mooon,代码行数:20,代码来源:check_sqllog.cpp
示例5: send_file
void send_file(t_all *all, char *cmd)
{
int fd;
char buff[MAX_SIZE];
cmd = cmd + 4;
if (check_file(cmd) == -1)
display_return_and_explanation(cmd, all->sv->c_sock, 0, 'f');
else
{
if ((fd = open(cmd, O_RDONLY)) == -1)
server_error("OPEN");
if (read(fd, buff, MAX_SIZE - 1) == -1)
server_error("READ");
// printf("%lu\n", sizeof(buff));
// all.
send(all->sv->c_sock, buff, ft_strlen(buff), 0);
}
/*send(all->sv->c_sock, pwd, ft_strlen(pwd), 0);*/
}
开发者ID:Sleli42,项目名称:ft_p,代码行数:20,代码来源:s_file.c
示例6: test
static void test(void)
{
int rv = 0;
const char file_a [] = "/FTP/127.0.0.1/a.txt";
const char file_b [] = "/FTP/127.0.0.1/b.txt";
rv = rtems_bsdnet_initialize_network();
rtems_test_assert(rv == 0);
rv = rtems_initialize_ftpd();
rtems_test_assert(rv == 0);
initialize_ftpfs();
change_self_priority();
create_file(file_a, &content [0], sizeof(content));
copy_file(file_a, file_b);
check_file(file_b);
check_file_size(file_a, sizeof(content));
check_file_size(file_b, sizeof(content));
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:20,代码来源:init.c
示例7: while
int FileOperation::write_file(const char* buf, const int32_t nbytes)
{
const char *p_tmp = buf;
int32_t left = nbytes;
int32_t written_len = 0;
int i = 0;
while (left > 0)
{
++i;
if (i >= MAX_DISK_TIMES)
{
break;
}
if (check_file() < 0)
return -errno;
if ((written_len = ::write(fd_, p_tmp, left)) <= 0)
{
written_len = -errno;
if (EINTR == -written_len || EAGAIN == -written_len)
{
continue;
}
if (EBADF == -written_len)
{
fd_ = -1;
continue;
}
else
{
return written_len;
}
}
left -= written_len;
p_tmp += written_len;
}
return p_tmp - buf;
}
开发者ID:xiangyong,项目名称:platform,代码行数:41,代码来源:file_op.cpp
示例8: write_data
int CTimerFile::write_data(const void *data, uint32_t len)
{
if (check_file() == -1)
{
return -1;
}
size_t res = fwrite(data, 1, len, m_file_stream);
if (res != len)
{
LOG_DEBUG("Write to file failed. %d, %s", errno, strerror(errno));
return -1;
}
fflush(m_file_stream);
m_cur_file_line++;
m_last_write_time = std::time(nullptr);
return 0;
}
开发者ID:Strongc,项目名称:mqtt_server,代码行数:21,代码来源:timer_file.cpp
示例9: read_config
static struct classifier_config*
read_config(FILE *input)
{
assert(input);
struct file_range types_section, atoms_section;
struct classifier_config *config = NULL;
struct classifier_types *types = NULL;
if (!(types = classifier_types_new()) ||
!(config = classifier_config_new()) ||
check_file(input, &types_section, &atoms_section) ||
read_types(types, input, types_section) ||
read_atoms(config, types, input, atoms_section) ||
config_copy_classes(config, types)) {
classifier_config_free(config);
config = NULL;
}
classifier_types_free(types);
return config;
}
开发者ID:harryjubb,项目名称:freesasa,代码行数:21,代码来源:classifier.c
示例10: main
int
main(int argc, char **argv)
{
unsigned char uchar_out[DIM1_LEN] = {0, 128, 255};
int format[MAX_NUM_FORMATS];
int num_formats;
int f = 0;
printf("\n*** Testing netcdf data conversion.\n");
determine_test_formats(&num_formats, format);
for (f = 0; f < num_formats; f++)
{
printf("*** Testing conversion in netCDF %s files... ", format_name[f]);
create_file(format[f], uchar_out);
check_file(format[f], uchar_out);
SUMMARIZE_ERR;
}
FINAL_RESULTS;
}
开发者ID:Unidata,项目名称:netcdf-c,代码行数:21,代码来源:tst_converts.c
示例11: load_file
LPTR load_file(LPTR address, status_t* result)
{
header_t* h = address;
*result = check_file(h);
if (*result != status_t::Ok)
return nullptr;
ph_t* ph = nullptr;
for (int i = 0; i < h->pht_entry_c; ++i)
{
ph = (uint32_t)h + h->pht_off + i*h->pht_entry_s;
if (ph->type != ph_type::Load)
continue;
memory::memcpy(ph->p_addr, (uint32_t)h +ph->offset, ph->size);
}
return h->entry;
}
开发者ID:ggwpez,项目名称:sxlb,代码行数:21,代码来源:elf.cpp
示例12: open_and_check_file
/* This opens and checks a netCDF file. */
int open_and_check_file(MPI_Comm comm, int iosysid, int iotype, int *ncid, char *fname,
char *attname, char *dimname, int disable_close, int my_rank)
{
int mode = PIO_WRITE;
int ret;
/* Open the file. */
if ((ret = PIOc_openfile(iosysid, ncid, &iotype, fname, mode)))
return ret;
/* Check the file. */
if ((ret = check_file(comm, iosysid, iotype, *ncid, fname, attname, dimname, my_rank)))
return ret;
/* Close the file, maybe. */
if (!disable_close)
if ((ret = PIOc_closefile(*ncid)))
return ret;
return PIO_NOERR;
}
开发者ID:Katetc,项目名称:cime,代码行数:22,代码来源:test_iosystem3.c
示例13: check_files
/* verify that the filesystem matches the package database */
static int check_files(alpm_pkg_t *pkg)
{
alpm_filelist_t *filelist = alpm_pkg_get_files(pkg);
char path[PATH_MAX], *rel;
const char *pkgname = alpm_pkg_get_name(pkg);
unsigned int i;
int ret = 0;
size_t space;
strncpy(path, alpm_option_get_root(handle), PATH_MAX);
rel = path + strlen(path);
space = PATH_MAX - (rel - path);
for(i = 0; i < filelist->count; ++i) {
alpm_file_t file = filelist->files[i];
int isdir = 0;
size_t len;
if(skip_noextract && match_noextract(handle, file.name)) { continue; }
strncpy(rel, file.name, space);
len = strlen(file.name);
if(rel[len - 1] == '/') {
isdir = 1;
rel[len - 1] = '\0';
}
if(check_file(pkgname, path, isdir) != 0) { ret = 1; }
}
if(include_db_files && check_db_files(pkg) != 0) {
ret = 1;
}
if(!quiet && !ret) {
eprintf("%s: all files match database\n", alpm_pkg_get_name(pkg));
}
return ret;
}
开发者ID:andrewgregory,项目名称:pacutils,代码行数:41,代码来源:paccheck.c
示例14: LOG
std::optional<std::string> plugin_searcher::find_extension(const std::string& name) {
LOG(DEBUG) << "Searching for Extension: " << name << "\n";
for (auto folder : active_mod_folder_list) {
#if _WIN64 || __X86_64__
std::string test_path = folder + "\\intercept\\" + name + "_x64.dll";
#else
#ifdef __linux__
std::string test_path = folder + "/intercept/" + name + ".so";
#else
std::string test_path = folder + "\\intercept\\" + name + ".dll";
#endif
#endif
LOG(DEBUG) << "Mod: " << test_path << "\n";
std::ifstream check_file(test_path);
if (check_file.good()) {
return test_path;
}
}
LOG(ERROR) << "Client plugin: " << name << " was not found.\n";
return std::optional<std::string>();
}
开发者ID:atlasicus,项目名称:intercept,代码行数:22,代码来源:search.cpp
示例15: set_test_name
void test_group<test_data>::object::test<3>() {
set_test_name("Test append-release recycling");
ensure_equals(file.get_block_count(), 1);
file.release_block(0);
ensure_equals(file.get_block_count(), 0);
ensure_equals(file.append_block(create_test_block(0)), 0);
ensure_equals(file.get_block_count(), 1);
ensure_equals(file.append_block(create_test_block(100)), 1);
ensure_equals(file.get_block_count(), 2);
file.close();
commons::io::recycling_block_file check_file("recycling_test_block_file", 512, free_block_initializer());
ensure_equals(check_file.get_block_count(), 2);
ensure_blocks_are_equals(check_file.read_block(0), create_test_block(0));
ensure_blocks_are_equals(check_file.read_block(1), create_test_block(100));
}
开发者ID:andres-arana,项目名称:degree-7506-tp,代码行数:22,代码来源:recycling_block_file_tests.cpp
示例16: redirr_proc
void redirr_proc(t_node *tree)
{
char *file;
int fd;
t_data *data;
file = ft_strtrim(tree->left->word);
data = init_data(0);
if (data->tmp_fdout == -1)
get_tmpfd(&data->tmp_fdout, "/.temp_out");
if (data->tmp_fdout != -1 && (fd = check_file(file)) != -1)
{
add_outfildes(&data->outfildes, file, fd);
read_tree(tree->right);
}
else
{
update_data(&data);
g_pid.built = 0;
}
ft_strdel(&file);
}
开发者ID:wtrembla,项目名称:New_42sh,代码行数:22,代码来源:redirr_fct.c
示例17: main
int main(int ac, char **av)
{
int fd;
int i;
int *lines;
int *ia_goal;
if (ac > 2)
error("ERROR\n");
if (ac == 2)
{
fd = open(av[1], O_RDONLY);
if (fd < 0)
error("ERROR\n");
}
else
fd = 0;
i = check_file(&lines, &ia_goal, fd);
if (i == 0)
error("ERROR\n");
play(lines, ia_goal, i - 1);
return (0);
}
开发者ID:Moerius,项目名称:rush,代码行数:23,代码来源:main.c
示例18: load_map
int load_map( const char* file, char map[MAP_HSIZE][MAP_WSIZE] ){
memset( map, EMPTY, sizeof(char) * MAP_HSIZE * MAP_WSIZE );
char path[120];
get_path( path, file );
if( !check_file( path ) ) return 0;
FILE* fp = fopen( path, "r" );
int i = 0, ii = 0;
char ch;
while( ( ch = fgetc( fp ) ) != EOF ){
if( ch == '\n' ){
if( ++i >= MAP_HSIZE ){ fclose( fp ); return 1; }
ii = 0;
} else {
if( ii < MAP_WSIZE ) map[i][ii] = ch;
ii++;
}
}
fclose( fp );
return 1;
}
开发者ID:nasciiboy,项目名称:ncurses,代码行数:23,代码来源:map.c
示例19: main
int main(int ac, char **av)
{
int fd;
char **tetris;
char *solution;
if (ac != 2)
ft_exit();
fd = open(av[1], O_RDONLY);
if (fd < 0)
ft_exit();
tetris = check_file(fd);
close(fd);
if (tetris == NULL)
ft_exit();
solution = solver(tetris);
if (solution == NULL)
ft_exit();
ft_putstr(solution);
clear_tab(tetris);
free(solution);
return (0);
}
开发者ID:jizzz,项目名称:42projects,代码行数:23,代码来源:main.c
示例20: brcmf_usb_probe_phase2
static void brcmf_usb_probe_phase2(struct device *dev,
const struct firmware *fw,
void *nvram, u32 nvlen)
{
struct brcmf_bus *bus = dev_get_drvdata(dev);
struct brcmf_usbdev_info *devinfo;
int ret;
brcmf_dbg(USB, "Start fw downloading\n");
devinfo = bus->bus_priv.usb->devinfo;
ret = check_file(fw->data);
if (ret < 0) {
brcmf_err("invalid firmware\n");
release_firmware(fw);
goto error;
}
devinfo->image = fw->data;
devinfo->image_len = fw->size;
ret = brcmf_usb_fw_download(devinfo);
release_firmware(fw);
if (ret)
goto error;
ret = brcmf_usb_bus_setup(devinfo);
if (ret)
goto error;
mutex_unlock(&devinfo->dev_init_lock);
return;
error:
brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret);
mutex_unlock(&devinfo->dev_init_lock);
device_release_driver(dev);
}
开发者ID:BORETS24,项目名称:common.git-android-4.4,代码行数:37,代码来源:usb.c
注:本文中的check_file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论