这篇教程C++ FCLOSE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FCLOSE函数的典型用法代码示例。如果您正苦于以下问题:C++ FCLOSE函数的具体用法?C++ FCLOSE怎么用?C++ FCLOSE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FCLOSE函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: MountableDevice/* * See if device can be mounted by looking in /etc/fstab. * If so, set device name and mount point name, and return 1, * otherwise return 0. */static int MountableDevice(const char *name, char **mountName, char **deviceName){ FILE *fp; char line[1024]; char s1[1024]; char s2[1024]; int rc; fp = fopen("/etc/fstab", "r"); if (fp == NULL) {/* * /etc/fstab may be unreadable in some situations due to passwords in the * file. */ return -1; } while (fgets(line, sizeof(line), fp) != 0) { rc = sscanf(line, "%1023s %1023s", s1, s2); if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) { FCLOSE(fp); *deviceName = estrdup(s1); *mountName = estrdup(s2); return 1; } } FCLOSE(fp); return 0;}
开发者ID:oasynnoum,项目名称:php-eject,代码行数:34,
示例2: DEHT_freeResourcesstatic void DEHT_freeResources(DEHT * ht, bool_t removeFiles){ TRACE_FUNC_ENTRY(); CHECK (NULL != ht); (void) fflush(ht->keyFP); FCLOSE(ht->keyFP); (void) fflush(ht->dataFP); FCLOSE(ht->dataFP); /* free ht cache if present */ FREE(ht->hashTableOfPointersImageInMemory); FREE(ht->hashPointersForLastBlockImageInMemory); FREE(ht->userBuf); if (removeFiles) { /* attempt to remove bad files. Errors are silenced */ CHECK(DEHT_removeFilesInternal(ht)); } /* finally, free the ht itself */ FREE(ht); goto LBL_CLEANUP;LBL_ERROR: /* do nothing special - just quit */ TRACE_FUNC_ERROR();LBL_CLEANUP: /* bye */ TRACE_FUNC_EXIT(); return;}
开发者ID:itn0x2e,项目名称:TestProj21218,代码行数:35,
示例3: fileCopy/****************************************************************************** * fileCopy: * Copy the file specified by "src" to the file specified by "dst". Error * checking is taken care of by the caplib functions (ie FOPEN, FWRITE, etc) */void fileCopy(const char *src, const char *dst){ char buffer[BUFFER_SIZE]; FILE *srcFp; FILE *dstFp; unsigned int amount; srcFp = FOPEN( src, "rb" ); dstFp = FOPEN( dst, "wb" ); do { amount = fread( buffer, sizeof(char), BUFFER_SIZE, srcFp ); if (amount) { int a = fwrite( buffer, sizeof(char), amount, dstFp ); if (a<amount) { asfPrintError("Error copying file %s -> %s/n" "Only %d of %d bytes written./n%s/n", src, dst, a, amount, strerror(errno)); } } /* when amount read is < BUFSZ, copy is done */ } while (amount == BUFFER_SIZE); FCLOSE(srcFp); FCLOSE(dstFp);}
开发者ID:glshort,项目名称:MapReady,代码行数:30,
示例4: floats_to_bytes_from_file_extvoid floats_to_bytes_from_file_ext(const char *inFile, const char *outFile, char *band, float mask, scale_t scaling, float scale_factor){ FILE *fp; meta_parameters *meta; float *float_data; unsigned char *byte_data; int ii, band_number; long long pixel_count; long offset; meta = meta_read(inFile); band_number = (!band || strlen(band) == 0 || strcmp(band, "???")==0) ? 0 : get_band_number(meta->general->bands, meta->general->band_count, band); pixel_count = meta->general->line_count * meta->general->sample_count; offset = meta->general->line_count * band_number; float_data = (float *) MALLOC(sizeof(float) * pixel_count); fp = FOPEN(inFile, "rb"); get_float_lines(fp, meta, offset, meta->general->line_count, float_data); FCLOSE(fp); byte_data = floats_to_bytes_ext(float_data, pixel_count, mask, scaling, scale_factor); for (ii=0; ii<pixel_count; ii++) float_data[ii] = (float) byte_data[ii]; meta->general->data_type = ASF_BYTE; meta_write(meta, outFile); fp = FOPEN(outFile, "wb"); put_float_lines(fp, meta, offset, meta->general->line_count, float_data); FCLOSE(fp); FREE(float_data); FREE(byte_data); meta_free(meta);}
开发者ID:rudigens,项目名称:ASF_MapReady,代码行数:33,
示例5: isArcListstatic int isArcList(const char *sensor, const char *file){ if (!file) return FALSE; if (!strstr(file, "arclist")) return FALSE; if (!fileExists(file)) return FALSE; FILE *fp = FOPEN(file, "r"); if (!fp) return FALSE; char line[1024]; if (fgets(line, 1024, fp) == NULL) { FCLOSE(fp); return FALSE; } FCLOSE(fp); if (!strstr(line, sensor)) return FALSE; return TRUE;}
开发者ID:talogan,项目名称:ASF_MapReady,代码行数:25,
示例6: write_qm_name/********************************************************************* Write the actual qmaster into the master_file -> master_file and master_host <- return -1 error in err_str 0 means OK NOTES MT-NOTE: write_qm_name() is MT safe *********************************************************************/int write_qm_name(const char *master_host,const char *master_file,char *err_str ) { FILE *fp; if (!(fp = fopen(master_file, "w"))) { if (err_str) sprintf(err_str, MSG_GDI_OPENWRITEMASTERHOSTNAMEFAILED_SS, master_file, strerror(errno)); return -1; } if (fprintf(fp, "%s/n", master_host) == EOF) { if (err_str) sprintf(err_str, MSG_GDI_WRITEMASTERHOSTNAMEFAILED_S , master_file); FCLOSE(fp); return -1; } FCLOSE(fp); return 0;FCLOSE_ERROR: return -1;}
开发者ID:HPCKP,项目名称:gridengine,代码行数:36,
|