MCPcopy Create free account
hub / github.com/Scobalula/Greyhound / FileStream_CreateFile

Function FileStream_CreateFile

src/External/CascLib/src/common/FileStream.cpp:2388–2424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2386 */
2387
2388TFileStream * FileStream_CreateFile(
2389 LPCTSTR szFileName,
2390 DWORD dwStreamFlags)
2391{
2392 TFileStream * pStream;
2393
2394 // We only support creation of flat, local file
2395 if((dwStreamFlags & (STREAM_PROVIDERS_MASK)) != (STREAM_PROVIDER_FLAT | BASE_PROVIDER_FILE))
2396 {
2397 SetCascError(ERROR_NOT_SUPPORTED);
2398 return NULL;
2399 }
2400
2401 // Allocate file stream structure for flat stream
2402 pStream = AllocateFileStream(szFileName, sizeof(TBlockStream), dwStreamFlags);
2403 if(pStream != NULL)
2404 {
2405 // Attempt to create the disk file
2406 if(BaseFile_Create(pStream))
2407 {
2408 // Fill the stream provider functions
2409 pStream->StreamRead = pStream->BaseRead;
2410 pStream->StreamWrite = pStream->BaseWrite;
2411 pStream->StreamResize = pStream->BaseResize;
2412 pStream->StreamGetSize = pStream->BaseGetSize;
2413 pStream->StreamGetPos = pStream->BaseGetPos;
2414 pStream->StreamClose = pStream->BaseClose;
2415 return pStream;
2416 }
2417
2418 // File create failed, delete the stream
2419 CASC_FREE(pStream);
2420 }
2421
2422 // Return the stream
2423 return pStream;
2424}
2425
2426/**
2427 * This function opens an existing file for read or read-write access

Callers 2

Storage_SeekFilesFunction · 0.85
SaveLocalFileFunction · 0.85

Calls 4

SetCascErrorFunction · 0.85
AllocateFileStreamFunction · 0.85
BaseFile_CreateFunction · 0.85
CASC_FREEFunction · 0.85

Tested by 1

Storage_SeekFilesFunction · 0.68