本文整理汇总了C++中File_Close函数的典型用法代码示例。如果您正苦于以下问题:C++ File_Close函数的具体用法?C++ File_Close怎么用?C++ File_Close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了File_Close函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Fwl_MoveFile
T_BOOL Fwl_MoveFile(T_pCWSTR oldFile,T_pCWSTR newFile)
{
T_BOOL ret = AK_FALSE;
T_hFILE source = 0;
T_hFILE dest = 0;
if (AK_NULL == oldFile || AK_NULL == newFile)
{
return AK_FALSE;
}
source = File_OpenUnicode((T_hFILE)AK_NULL, oldFile, FILE_MODE_READ);
if (FS_INVALID_HANDLE == source)
{
return AK_FALSE;
}
dest = File_OpenUnicode((T_hFILE)AK_NULL, newFile, FILE_MODE_READ);
if (FS_INVALID_HANDLE== dest)
{
File_Close(source);
return AK_FALSE;
}
ret = File_RenameTo(source, dest);
File_Close(source);
File_Close(dest);
return ret;
}
示例2: D88_SetFD
int D88_SetFD(int drv, char* filename)
{
int trk, sct;
FILEH fp;
D88_SECTOR d88s;
strncpy(D88File[drv], filename, MAX_PATH);
D88File[drv][MAX_PATH-1] = 0;
fp = File_Open(D88File[drv]);
if ( !fp ) {
ZeroMemory(D88File[drv], MAX_PATH);
return FALSE;
}
File_Seek(fp, 0, FSEEK_SET);
if ( File_Read(fp, &D88Head[drv], sizeof(D88_HEADER))!=sizeof(D88_HEADER) ) goto d88_set_error;
if ( D88Head[drv].protect ) {
FDD_SetReadOnly(drv);
}
for (trk=0; trk<164; trk++) {
long ptr = D88Head[drv].trackp[trk];
D88_SECTINFO *si, *oldsi = NULL;
if ( (ptr>=(long)sizeof(D88_HEADER))&&(ptr<D88Head[drv].fd_size) ) {
d88s.sectors = 65535;
File_Seek(fp, ptr, FSEEK_SET);
for (sct=0; sct<d88s.sectors; sct++) {
if ( File_Read(fp, &d88s, sizeof(D88_SECTOR))!=sizeof(D88_SECTOR) ) goto d88_set_error;
si = (D88_SECTINFO*)malloc(sizeof(D88_SECTINFO)+d88s.size);
if ( !si ) goto d88_set_error;
if ( sct ) {
oldsi->next = si;
} else {
D88Trks[drv][trk] = si;
}
memcpy(&si->sect, &d88s, sizeof(D88_SECTOR));
if ( File_Read(fp, ((unsigned char*)si)+sizeof(D88_SECTINFO), d88s.size)!=d88s.size ) goto d88_set_error;
si->next = 0;
if (oldsi) oldsi = si;
}
}
}
File_Close(fp);
return TRUE;
d88_set_error:
File_Close(fp);
FDD_SetReadOnly(drv);
return FALSE;
}
示例3: RUCE_Roto_CtorLoad
int RUCE_Roto_CtorLoad(RUCE_Roto* This, String* Path)
{
int Ret = 1;
File RotoFile;
String RotoContent;
String_Ctor(& RotoContent);
File_Ctor(& RotoFile);
if(! File_Open(& RotoFile, Path, READONLY))
{
Ret = 0;
goto End;
}
File_Read_String(& RotoFile, & RotoContent);
This -> Ptr = cJSON_Parse(String_GetChars(& RotoContent));
if(! This -> Ptr)
Ret = 0;
End:
File_Close(& RotoFile);
File_Dtor(& RotoFile);
String_Dtor(& RotoContent);
RInit(RUCE_Roto);
return Ret;
}
示例4: Fwl_FileExist
T_BOOL Fwl_FileExist(T_pCWSTR path)
{
T_hFILE pFile = 0;
T_BOOL ret = AK_FALSE;
if (AK_NULL != path)
{
pFile = File_OpenUnicode((T_hFILE)AK_NULL, path, FILE_MODE_READ);
if (FS_INVALID_HANDLE == pFile)
{
pFile = File_OpenUnicode((T_hFILE)AK_NULL, path, FILE_MODE_ASYN | FILE_MODE_READ);
if (FS_INVALID_HANDLE == pFile)
{
//AK_DEBUG_OUTPUT("FWL FILE ERROR: Fwl_FileExist:open fail %d\n", pFile);
return AK_FALSE;
}
}
ret = File_Exist(pFile);
File_Close(pFile);
}
return ret;
}
示例5: MIDI_SetMimpiMap
int MIDI_SetMimpiMap(char *filename) {
BYTE b;
FILEH fh;
char buf[128];
LOADED_TONEMAP = 0;
ZeroMemory(TONE_CH, sizeof(TONE_CH));
ZeroMemory(TONEBANK[0], sizeof(TONEBANK));
for (b=0; b<128; b++) {
TONEMAP[0][b] = b;
TONEMAP[1][b] = b;
TONEMAP[2][b] = b;
}
TONE_CH[9] = MIMPI_RHYTHM;
if ((filename == NULL) || (!filename[0])) {
ENABLE_TONEMAP = 0;
return(FALSE);
}
fh = File_Open(filename);
if (fh == (FILEH)-1) {
ENABLE_TONEMAP = 0;
return(FALSE);
}
while(file_readline(fh, buf, sizeof(buf)) >= 0) {
mimpidefline_analaize(buf);
}
File_Close(fh);
LOADED_TONEMAP = 1;
return(TRUE);
}
示例6: writeconfig
/* write config to file */
void writeconfig(_In_ Config* config)
{
FILE* configfile = File_Open(config->configFilepath, "w");
if (!configfile)
{
return;
}
LOGMSG(("created config file (%s)", config->configFilepath));
fprintf(configfile, gformat1,
config->testGroup,
config->intervalMS,
config->failAfterCount,
config->failResult,
config->initBehavior,
config->initResultCode,
config->initTimeoutMS,
config->finalizeBehavior,
config->finalizeResultCode,
config->postBehavior,
config->miscTestSubGroup,
config->evalResult,
config->logLoadUnloadCall);
fprintf(configfile, gformat2,
config->subscribeBookmark,
config->providerBookmark,
config->dialect,
config->expression);
File_Close(configfile);
}
示例7: ScreenGrab_Update
void ScreenGrab_Update( void )
{
char lFileName[ 264 ];
sDegasHeader lHeader;
sFileHandle lHandle;
if( IKBD_GetKeyStatus( gScreenGrabKeyIndex ) )
{
if( !gScreenGrabKeyState )
{
sprintf( lFileName, "%sGRAB%04x.PI1", gScreenGrabDirectory, gScreenGrabIndex );
lHandle = File_Create( lFileName );
if( lHandle > 0 )
{
lHeader.Mode = 0;
Video_GetPalST( &lHeader.Palette[ 0 ] );
File_Write( lHandle, sizeof(sDegasHeader), &lHeader );
File_Write( lHandle, 32000, Video_GetpPhysic() );
File_Close( lHandle );
gScreenGrabIndex++;
}
gScreenGrabKeyState = 1;
}
}
else
{
gScreenGrabKeyState = 0;
}
}
示例8: Mij_SetButton
VOID Mij_SetButton( MOTIONINJOY_BUTTON_MAP* ButtonMapping )
{
HANDLE driverHandle;
IO_STATUS_BLOCK isb;
MOTIONINJOY_APP_OPTION options;
File_Create(
&driverHandle,
L"\\\\.\\MIJFilter",
SYNCHRONIZE | FILE_READ_DATA | FILE_WRITE_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL
);
Memory_Clear(&options, sizeof(MOTIONINJOY_APP_OPTION));
options.CommonOption.mode = Keyboard;
options.CommonOption.LED = 129;
options.CommonOption.AutoOff_timeout = 0x80 | /*PushSharedMemory->ControllerTimeout*/10; //minutes
options.CommonOption.Deadzone_LStick_X = 10;
options.CommonOption.Deadzone_LStick_Y = 10;
options.InputOption.Duration = 100;
options.InputOption.Interval = 400;
Memory_Copy(&options.InputOption.Maping, ButtonMapping, sizeof(MOTIONINJOY_BUTTON_MAP));
NtDeviceIoControlFile(driverHandle, NULL, NULL, NULL, &isb, IOCTL_MIJ_SET_CONFIG_OPTIONS, &options, 256, NULL, 0);
File_Close(driverHandle);
}
示例9: File_Seek
/**
* Seek inside a file.
*
* @param index The index given by File_Open() of the file.
* @param position Position to fix to.
* @param mode Mode of seeking. 0 = SEEK_SET, 1 = SEEK_CUR, 2 = SEEK_END.
* @return The new position inside the file, relative from the start.
*/
uint32 File_Seek(uint8 index, uint32 position, uint8 mode)
{
if (index >= FILE_MAX) return 0;
if (s_file[index].fp == NULL) return 0;
if (mode > 2) { File_Close(index); return 0; }
g_fileOperation++;
switch (mode) {
case 0:
fseek(s_file[index].fp, s_file[index].start + position, SEEK_SET);
s_file[index].position = position;
break;
case 1:
fseek(s_file[index].fp, (int32)position, SEEK_CUR);
s_file[index].position += (int32)position;
break;
case 2:
fseek(s_file[index].fp, s_file[index].start + s_file[index].size - position, SEEK_SET);
s_file[index].position = s_file[index].size - position;
break;
}
g_fileOperation--;
return s_file[index].position;
}
示例10: _MPIStream_Printf
SizeT _MPIStream_Printf( Stream* stream, char *fmt, va_list args )
{
MPIStream* self = (MPIStream*)stream;
MPI_Status status;
char* buffer;
SizeT numChars;
int writeResult;
if ( self->_file == NULL )
{
return 0;
}
numChars = Stg_vasprintf( &buffer, fmt, args );
writeResult = MPI_File_write( *(MPI_File*)(self->_file->fileHandle), buffer, numChars, MPI_BYTE, &status );
if (writeResult != MPI_SUCCESS) {
char errorString[2000];
int errorStringLength = 0;
Stream* errorStream = Journal_Register( Error_Type, MPIFile_Type );
int myRank = 0;
MPI_Comm_rank( MPI_COMM_WORLD, &myRank );
MPI_Error_string( writeResult, errorString, &errorStringLength);
Journal_Printf( errorStream, "%3d: %s\n", myRank, errorString );
File_Close( self->_file );
MPI_Abort(MPI_COMM_WORLD, writeResult );
}
Memory_Free( buffer );
return 0;
}
示例11: Profiler_DeInit
void Profiler_DeInit( void )
{
Profiler_Disable();
*(U32*)0x68 = gProfilerOldHBL;
File_Close( gProfilerHandle );
Memory_Release( gpProfilerBuffer );
}
示例12: SetMacro
void SetMacro( unsigned __int8 Count, MOTIONINJOY_MACRO* Macro )
{
HANDLE driverHandle;
BYTE b;
MOTIONINJOY_BUTTON_MACRO macro;
IO_STATUS_BLOCK isb;
File_Create(
&driverHandle,
L"\\\\.\\MIJFilter",
SYNCHRONIZE | FILE_READ_DATA | FILE_WRITE_DATA,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL
);
Memory_Clear(¯o, sizeof(MOTIONINJOY_BUTTON_MACRO));
macro.DeviceIndex = 0;
macro.EIndex = 0;
b = 0;
while ((int)b < ((Count > 6) ? 6 : Count))
{
int i;
macro.MacroIndex = b;
macro.Duration = Macro->Duration;
Memory_Copy(macro.Command, Macro->Command, sizeof(macro.Command));
// Fill button intervals
for (i = 0; i < 6; i++)
{
macro.ButtonIndex = i;
Memory_Copy(macro.Button, Macro->ButtonIntervals[i], sizeof(macro.Button));
NtDeviceIoControlFile(
driverHandle,
NULL, NULL, NULL,
&isb,
IOCTL_MIJ_SET_CONFIG_MACRO,
¯o,
sizeof(MOTIONINJOY_BUTTON_MACRO),
NULL,
0
);
}
b++;
Macro++;
}
File_Close(driverHandle);
}
示例13: SzArEx_Free
void Qt7zPackage::close()
{
if (m_p->m_isOpen) {
SzArEx_Free(&(m_p->m_db), &(m_p->m_allocImp));
File_Close(&(m_p->m_archiveStream.file));
m_p->m_isOpen = false;
}
}
示例14: File_ReadBlockFile
/**
* Reads length bytes from filename into buffer.
*
* @param filename Then name of the file to read.
* @param buffer The buffer to read into.
* @param length The amount of bytes to read.
* @return The amount of bytes truly read, or 0 if there was a failure.
*/
uint32 File_ReadBlockFile(const char *filename, void *buffer, uint32 length)
{
uint8 index;
index = File_Open(filename, 1);
length = File_Read(index, buffer, length);
File_Close(index);
return length;
}
示例15: SzArEx_Free
void SZFilePack::close()
{
if (mIsPackOpened) {
SzArEx_Free(&mDb, &mAllocImp);
File_Close(&mArchiveStream.file);
mIndexMap.clear();
mIsPackOpened = false;
}
}