Exemplo n.º 1
0
/*
 * Sets up data recording and video recording
 * Will record video if exp->RECORDVID is 1
 * and record data if exp->RECORDDATA is 1
 *
 */
int SetupRecording(Experiment* exp) {

	printf("About to setup recording\n");
	char* DataFileName;
	if (exp->RECORDDATA) {
		if (exp->dirname == NULL || exp->outfname == NULL)
			printf("exp->dirname or exp->outfname is NULL!\n");

		/** Setup Writing and Write Out Comments **/
		exp->DataWriter = SetUpWriteToDisk(exp->dirname,exp->outfname, exp->Worm->MemStorage);

		/** We should Quit Now if any of the data Writing is not working **/
		if (exp->DataWriter->error < 0 ) return -1;

		/** Write the Command Line argument Out for reference **/
		WriteOutCommandLineArguments(exp->DataWriter, exp->argc, exp->argv);

		/**  Write out the default grid size for non-protocol based illumination **/
		WriteOutDefaultGridSize(exp->DataWriter, exp->Params);

		/** Write the Protocol Out for reference **/
		if (exp->pflag) {
			WriteProtocol(exp->p, exp->DataWriter->fs);
		}

		BeginToWriteOutFrames(exp->DataWriter);

		printf("Initialized data recording\n");
		DestroyFilename(&DataFileName);
	}

	/** Set Up Video Recording **/
	char* MovieFileName;
	char* HUDSFileName;

	if (exp->RECORDVID) {
		if (exp->dirname == NULL || exp->outfname == NULL)
			printf("exp->dirname or exp->outfname is NULL!\n");

		MovieFileName = CreateFileName(exp->dirname, exp->outfname, ".avi");
		HUDSFileName = CreateFileName(exp->dirname, exp->outfname, "_HUDS.avi");

		exp->Vid = cvCreateVideoWriter(MovieFileName,
				CV_FOURCC('M','J','P','G'), 30, cvSize(NSIZEX / 2, NSIZEY / 2),
				0);
		exp->VidHUDS = cvCreateVideoWriter(HUDSFileName,
				CV_FOURCC('M','J','P','G'), 30, cvSize(NSIZEX / 2, NSIZEY / 2),
				0);
		if (exp->Vid ==NULL ) printf("\tERROR in SetupRecording! exp->Vid is NULL\n");
		if (exp->VidHUDS ==NULL ) printf("\tERROR in SetupRecording! exp->VidHUDS is NULL\n");
		DestroyFilename(&MovieFileName);
		DestroyFilename(&HUDSFileName);
		printf("Initialized video recording\n");
	}
	return 0;

}
Exemplo n.º 2
0
//------------
//
void InitLogoMemory( void )
{
	int i, count;
    int countTvSvc, countRadioSvc;
	TYPE_TapChInfo	currentChInfo;

	TAP_Channel_GetTotalNum( &countTvSvc, &countRadioSvc );				// how many services are defined on this box?

	if ( countTvSvc > MAX_SERVICES/2 )
	{                                                                   // must quit if too many services
//	    ErrorPrint("Too many services");                                // TF5800 won't be affected	- so hack ok for us 
//		return;															// temp - must fix.
		countTvSvc = MAX_SERVICES/2;
	}
	if ( countRadioSvc > MAX_SERVICES/2 )
	{
		countRadioSvc = MAX_SERVICES/2;
	}


	for ( i=0; i<=countTvSvc; i++)										// for each TV service
	{
		TAP_Channel_GetInfo( SVC_TYPE_Tv, i, &currentChInfo );			// get the info pointer
		strcpy( logoArrayTv[i].svcName, currentChInfo.chName);			// and copy the channel's name

		logoArrayTv[i].svcLCN = currentChInfo.logicalChNum;				// service LCN
		logoArrayTv[i].svcNum = i;										// service number
		logoArrayTv[i].svcType = SVC_TYPE_Tv;							// service type (TV, or Radio)
		logoArrayTv[i].processedFlag = FALSE;							// no logo cached yet
		logoArrayTv[i].logo = TAP_MemAlloc( LOGO_DATA_SIZE );			// allocate space for the logo
		CreateFileName( &logoArrayTv[i] );								// filter out puntuation and generate a file name
	}

	for ( i=0; i<=countRadioSvc; i++)									// do the same for each radio service on this box
	{
		TAP_Channel_GetInfo( SVC_TYPE_Radio, i, &currentChInfo );
		strcpy( logoArrayRadio[i].svcName, currentChInfo.chName);

		logoArrayRadio[i].svcLCN = currentChInfo.logicalChNum;				// service LCN
		logoArrayRadio[i].svcNum = i;
		logoArrayRadio[i].svcType = SVC_TYPE_Radio;
		logoArrayRadio[i].processedFlag = FALSE;
		logoArrayRadio[i].logo = TAP_MemAlloc( LOGO_DATA_SIZE );
		CreateFileName( &logoArrayRadio[i] );							// filter out puntuation and generate a file name
	}

	maxTvSvc = countTvSvc;												// save the number of services for later
	maxRadioSvc = countRadioSvc;

	logoIndex = 0;
}
Exemplo n.º 3
0
static LPBYTE D3Handler_Search(TRootHandler_Diablo3 * pRootHandler, TCascSearch * pSearch, PDWORD /* PtrFileSize */, PDWORD /* PtrLocaleFlags */, PDWORD /* PtrFileDataId */)
{
    PCASC_FILE_ENTRY pFileEntry;
    const char * szSrcName = NULL;

    // Are we still inside the root directory range?
    while(pSearch->IndexLevel1 < pRootHandler->FileTable.ItemCount)
    {
        // Get the n-th directory and the file name
        pFileEntry = (PCASC_FILE_ENTRY)Array_ItemAt(&pRootHandler->FileTable, pSearch->IndexLevel1);
        szSrcName = (char *)Array_ItemAt(&pRootHandler->FileNames, pFileEntry->dwFileName);

        // This is either a full file name or an abbreviated name
        if(pFileEntry->dwFlags & CASC_ENTRY_SHORT_NAME)
        {
            CreateFileName(pRootHandler, szSrcName, pSearch->szFileName);
        }
        else
        {
            strcpy(pSearch->szFileName, szSrcName);
        }

        // Prepare for the next search
        pSearch->IndexLevel1++;
        return pFileEntry->EncodingKey.Value;
    }

    // No more entries
    return NULL;
}
Exemplo n.º 4
0
CmtFileBase*
CmtFat::FileCreate( cpchar fname, int32 msMode ) {
  FatDirEntry1x *ptr = 0;
  CmtFileBase *file = 0;
  devLock();
  if( msMode & CMT_CREATE_WRITE ) {
    //Открыть для записи
    ptr = FindFile( fname );
    //Если уже существует, то удалить файл
    if( ptr && (msMode & CMT_FILE_RESET) ) {
      DeleteFileEntry( ptr );
      ptr = 0;
      }
    //Создать новый файл
    if( ptr == 0 )
      ptr = CreateFileName( fname );
    }
  else if( msMode & CMT_CREATE_READ ) {
    //Открыть для чтения
    ptr = FindFile( fname );
    }
  if( ptr ) {
    //Файл найден
    file = new CmtFatFile( this, ptr, msMode );
    }
  devUnLock();
  return file;
  }
Exemplo n.º 5
0
static void ResolveFullFileNames(
    TRootHandler_Diablo3 * pRootHandler,
    PDIABLO3_CORE_TOC_ENTRY pCoreTocEntries,
    PCASC_MAP pPackageMap,
    LPBYTE pbCoreTocFile,
    DWORD dwFileIndexes)
{
    PCASC_FILE_ENTRY pFileEntry;
    char * szPlainName;
    char * szNamePtr;
    size_t nLength;
    DWORD dwRootIndex;
    DWORD dwFileIndex;
    DWORD dwSubIndex;
    char szShortName[MAX_PATH+1];
    char szFullName[MAX_PATH+1];

    // Keep compiler happy
    CASCLIB_UNUSED(dwFileIndexes);

    // Parse the entire file table
    for(size_t i = 0; i < pRootHandler->FileTable.ItemCount; i++)
    {
        // Retrieve the file entry at n-th position
        pFileEntry = (PCASC_FILE_ENTRY)Array_ItemAt(&pRootHandler->FileTable, i);

        // Skip the items that already have full name
        if(pFileEntry->dwFlags & CASC_ENTRY_SHORT_NAME)
        {
            // Retrieve the file index of that file
            dwRootIndex = INDEX64_ROOT_INDEX(pFileEntry->FileNameHash);
            dwFileIndex = INDEX64_FILE_INDEX(pFileEntry->FileNameHash);
            dwSubIndex = (pFileEntry->dwFlags & CASC_ENTRY_HAS_SUBINDEX) ? INDEX64_SUB_INDEX(pFileEntry->FileNameHash) : DIABLO3_INVALID_INDEX;
            assert(dwFileIndex < dwFileIndexes);

            // Get the plain name of the file
            szPlainName = (char *)(pbCoreTocFile + pCoreTocEntries[dwFileIndex].NameOffset);

            // Create the short file name
            nLength = CreateShortName(pPackageMap,
                                      dwRootIndex,
                                      pCoreTocEntries[dwFileIndex].AssetIndex,
                                      szPlainName,
                                      dwSubIndex,
                                      szShortName);

            // Insert the short name to the list of the names
            szNamePtr = (char *)Array_Insert(&pRootHandler->FileNames, szShortName, nLength + 1);
            pFileEntry->dwFileName = (DWORD)Array_IndexOf(&pRootHandler->FileNames, szNamePtr);

            // Create the full file name
            nLength = CreateFileName(pRootHandler, szShortName, szFullName);
            pFileEntry->FileNameHash = CalcFileNameHash(szFullName);

            // Insert the entry to the name map. Use the mapping of FullName -> FileHash
            Map_InsertObject(pRootHandler->pRootMap, pFileEntry, &pFileEntry->FileNameHash);
        }
    }
}
Exemplo n.º 6
0
void CConfigList::AddEntryToList(CConfigEntry *e) 
{
  char fname[PATH_MAX];

  CreateFileName(e->GetName(), fname);
  e->SetFileName(fname);
  e->SetNext(m_config_list);
  m_config_list = e;
  m_config_count++;
}
Exemplo n.º 7
0
UI32 CSWF::SaveFrame(UI16 usClipID, UI16 usFrame)
{
	UI16 usFrameCount=0;
	char szFrameFileName[MAX_FILEPATH];
	DEFINESPRITE *lpdsSprite;
	CSWF cswfFrameFlash;

	if(ubFrameFormat==1)
		return SaveFrameAsSVG(usClipID,usFrame);

	if(usClipID) 
	{
		lpdsSprite=(DEFINESPRITE*)lprgvpCharacters[usClipID];
		if(lpdsSprite->rhTagHeader.usTagCode!=TAGCODE_DEFINESPRITE) 
			return 0;
		return SaveDefineSprite(lpdsSprite,usFrame);
	}

	cswfFrameFlash.SetFileHeader(&fhFileHeader);
	cswfFrameFlash.SetFrameHeader(&fhFrameHeader);
	cswfFrameFlash.AddTag(lpbcBackground);

	for(UI32 iTag=0; usFrameCount<usFrame && iTag<nTags; iTag++)
	{
		UI16 usTagCode=((UNKNOWNTAG*)lprgvpTags[iTag])->rhTagHeader.usTagCode;
		
		if(usTagCode==TAGCODE_SOUNDSTREAMBLOCK) continue;
		if(usTagCode==TAGCODE_DEFINESOUND) continue;
		if(usTagCode==TAGCODE_STARTSOUND) continue;

		if(usTagCode==TAGCODE_SHOWFRAME)
		{
			usFrameCount++;
			continue;
		}
		
		cswfFrameFlash.AddTag(lprgvpTags[iTag]);	
	}

	/*END*/
	UNKNOWNTAG utShowFrame;
	memset(&utShowFrame,0,sizeof(UNKNOWNTAG));
	utShowFrame.rhTagHeader.usTagCode=TAGCODE_SHOWFRAME;
	cswfFrameFlash.AddTag(&utShowFrame);

	UNKNOWNTAG utEnd;
	memset(&utEnd,0,sizeof(UNKNOWNTAG));
	utEnd.rhTagHeader.usTagCode=TAGCODE_END;
	cswfFrameFlash.AddTag(&utEnd);

	CreateFileName(szFrameFileName,"frame",usFrame,"swf");
	cswfFrameFlash.Save(szFrameFileName);
	return 1;
}
Exemplo n.º 8
0
bool CDirList::Traverse(
  const wxString &sDirInput, 
  const wxString &sDirOutput,
  int nFileType)
{
  INITMAP();
  Cleanup();
  if(!nFileType)
  {
    nFileType = FILE_ANY;
  }
  m_nFileType = nFileType;
  if(!wxDir::Exists(sDirInput)) //wxFileName::Mkdir(sDirInput,0755,wxPATH_MKDIR_FULL))
  {
    m_nStatus = DIRLIST_INPUT_NOT_EXIST;
  }
  else if(!wxFileName::Mkdir(sDirOutput,0755,wxPATH_MKDIR_FULL))
  {
    m_nStatus = DIRLIST_OUTPUT_NOT_EXIST;
  }
  else
  {
    wxFileName fnIn(sDirInput);
    wxFileName fnOut(sDirOutput);
    m_sDirInput = fnIn.GetFullPath();
    m_sDirOutput = fnOut.GetFullPath();
    m_sDirSave.Empty();
    m_sDirLoad.Empty();

    // for each input file, remove base input and last dir
    // append to output dir
    nwxFileUtil::EndWithSeparator(&m_sDirOutput);
    nwxFileUtil::NoEndWithSeparator(&m_sDirInput);
    m_sDirInputBase = fnIn.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
    nwxFileUtil::EndWithSeparator(&m_sDirInputBase);
    if(m_parmOsiris.GetTimeStampSubDir())
    {
      CreateFileName(true);
    }
    else
    {
      ClearTimeStamp();
    }
    wxDir dirIn(sDirInput);
    OnDir(sDirInput);
    dirIn.Traverse(*this,wxEmptyString,wxDIR_DIRS);
    m_nStatus = m_vpDir->empty() ? DIRLIST_EMPTY : DIRLIST_OK;
    m_setDirs.clear();
  }
  return IsOK();
};
Exemplo n.º 9
0
ERRCOD_T LogFile::OpenFile( )
{
	CreateFileName( );
	// ### Add 2006-06-05, by Wu jianjin.
	/*struct stat  * statbuf;
	int r;
	r=stat(filename, statbuf);
	if (0 == r)
	{
		totalFileLength = statbuf->st_size;
	}*/
	// ### End ###
			

	if (filename[0] != '\0')
	{
		fp = fopen(filename, "a"); // Open the file with append mode, if the file no exist, it will be created.
		if (NULL == fp)
		{ // File open failed, exception handle.
			#ifndef __TEST__
			if (NULL != xcpPtr)
			{
				xcpPtr->error(E_FILE_OPEN_FAILED, SF_LOGFILE, filename);
			}
			#endif // ifndef __TEST__

			return E_FILE_OPEN_FAILED;
		}
		else
		{
			totalFileLength = ftell(fp);
			if (totalFileLength < 0L)
			{
				totalFileLength = 0L;
			}

			return E_SUCC;
		}
	}
	else
	{
		#ifndef __TEST__
		if (NULL != xcpPtr)
		{
			xcpPtr->error(E_FILE_NAME_NULL, SF_LOGFILE, filename);
		}
		#endif // ifndef __TEST__
		
		return E_FILE_NAME_NULL;
	}
}
Exemplo n.º 10
0
ERRCOD_T LogFile::ReOpenFile( )
{
	ERRCOD_T errcod;
	
	// errcod = CloseFile( ); // Delete 2006-06-02, by Wu jianjin.
	if (fp != NULL)
	{
		fclose(fp); // Add 2006-06-02, by Wu jianjin.
		fp = NULL; // Add 2006-06-02, by Wu jianjin.
	}
	
	errcod = E_SUCC; // Add 2006-06-02, by Wu jianjin.

	if (errcod == E_SUCC)
	{
		CreateFileName( );

		if (filename[0] != '\0')
		{
			fp = fopen(filename, "a+"); // Open the file with append mode, if the file no exist, it will be created.
			if (NULL == fp)
			{ // File open failed, exception handle.
				#ifndef __TEST__
				if (NULL != xcpPtr)
				{
					xcpPtr->error(E_FILE_OPEN_FAILED, SF_LOGFILE, filename);
				}
				#endif // ifndef __TEST__
				
				return E_FILE_OPEN_FAILED;
			}
			else
				return E_SUCC;
		 }
		else
		{
			#ifndef __TEST__
			if (NULL != xcpPtr)
			{
				xcpPtr->error(E_FILE_NAME_NULL, SF_LOGFILE, filename);
			}
			#endif // ifndef __TEST__
			
			return E_FILE_NAME_NULL;
		}
	}
	else
		return errcod;
}
Exemplo n.º 11
0
// втыкаем блокнот имму
void Board::init_god_board(long uid, std::string name)
{
	BoardPtr board(new Board);
	board->type = PERS_BOARD;
	board->name = "Блокнот";
	board->desc = "Ваш раздел для заметок";
	board->persUnique = uid;
	board->persName = name;
	// генерим имя и лоадим по возможности
	std::string tmp_name = name;
	CreateFileName(tmp_name);
	board->file = ETC_BOARD + tmp_name + ".board";
	board->Load();
	Board::BoardList.push_back(board);
}
Exemplo n.º 12
0
BOOL CLogging::InitLoggingFile(const char *szBaseName, const char *szExtension, const char *szDir, BOOL bDayExtension)
{
    int iErr;

    // See if we already have one
    if (pFile)
        return (TRUE);

    if (!szDir)
#if defined(_WIN32)
        szDir = ".\\";
#else
        szDir = "../";
#endif
    sBaseName = szBaseName;
    sLogFileDir = szDir;
    bDayExt = bDayExtension;

    // Create the file name
    sFileName = CreateFileName(szBaseName, szDir, bDayExtension, szExtension);

    // Open it
    pFile = OpenLogFile();
    if (!pFile)
    {
#if defined(_WIN32)
        iErr = ::GetLastError();
#else
        iErr = errno;
#endif
        printf("Unable to open log file. Error returned was: \"%s\"\n", ::strerror(iErr));
        return (iErr);
    };

    // Get the full path name
#if defined(_WIN32)
    // Win32 only!
    char *lpFilePart;
    DWORD dwSize;

    dwSize = ::GetFullPathName(sFileName.c_str(), 0, NULL, NULL);
    sPath.reserve(dwSize + 1);
    dwSize = ::GetFullPathName(sFileName.c_str(), dwSize + 1, (char *) sPath.c_str(), &lpFilePart);
#endif
    if (bCloseMode)
        CloseLogFile();
    return (0);
};
Exemplo n.º 13
0
//                              CDirList::SaveFile()
//
//  generate file name based on output dir and time
//    file name begins with dir name and ends 
//    with ".obr" (osiris batch report)
//
//
bool CDirList::SaveFile()
{
  bool bRtn = CreateFileName();
  if(bRtn)
  {
    bRtn = SaveFile(m_sFileName);
  }
  if(bRtn)
  {
    m_sDirLoad = GetSavePath();
  }
  else
  {
    m_sDirLoad.Empty();
    m_sDirSave.Empty();
  }
  return bRtn;
}
Exemplo n.º 14
0
bool CConfigList::CreateConfig (const char *proname)
{
  char fpathandname[PATH_MAX];
  if (FindConfigInt(proname) != NULL) {
    error_message("Config %s already exists", proname);
    return false;
  }
  CreateFileName(proname, fpathandname);
  m_config_list = CreateConfigInt(fpathandname, m_config_list);
  m_config_list->Initialize(false);
  if (m_config_list->SetConfigName(proname) == false) {
    error_message("can't set config name %s", proname);
    return false;
  }
  if (m_config_list->IsValid()) {
    m_config_count++;
    m_config_list->Update();
  }
  return true;
}
Exemplo n.º 15
0
/*
 * Sets up the WriteToDisk  given the base of a filname.
 * Creates a WriteOut Object.
 *
 * e.g. if you want to create a files named myexperiment.yaml and myexperiment.mov
 * pass in the string "myexperiment"
 *
 */
WriteOut* SetUpWriteToDisk(const char* dirfilename, const char* outfilename,  CvMemStorage* Mem){
	/** Create new instance of WriteOut object **/
	WriteOut* DataWriter = CreateDataWriter();

	/** Create Filenames **/
	char* YAMLDataFileName = CreateFileName(dirfilename, outfilename, ".yaml");

	/** Open YAML Data File for writing**/
	DataWriter->fs=cvOpenFileStorage(YAMLDataFileName,Mem,CV_STORAGE_WRITE);
	if (DataWriter->fs==0) {
		printf("DataWriter->fs is zero! Could you have specified the wrong directory?\n");
		--(DataWriter->error);
	}




	/** If there were errors, return immediately **/
	if (DataWriter->error < 0) return DataWriter;


	/** Write the header for the YAML data file **/
	cvWriteComment(DataWriter->fs, "Remote Control Worm Experiment Data Log\nMade by OpticalMindControl software\[email protected]\n",0);
	cvWriteString(DataWriter->fs, "gitHash", build_git_sha,0);
	cvWriteString(DataWriter->fs, "gitBuildTime",build_git_time,0);

	/** Write Out Current Time**/
	  struct tm *local;
	  time_t t;

	  t = time(NULL);
	  local = localtime(&t);

	cvWriteString(DataWriter->fs, "ExperimentTime",asctime(local),0);

	DataWriter->filename=YAMLDataFileName;

	return DataWriter;
}
Exemplo n.º 16
0
// лоад/релоад клановых досок
void Board::ClanInit()
{
	// чистим для релоада
	for (BoardListType::iterator board = Board::BoardList.begin(); board != Board::BoardList.end(); ++board)
	{
		if ((*board)->type == CLAN_BOARD || (*board)->type == CLANNEWS_BOARD)
		{
			Board::BoardList.erase(board);
			board = Board::BoardList.begin();
		}
	}

	for (ClanListType::const_iterator clan = Clan::ClanList.begin(); clan != Clan::ClanList.end(); ++clan)
	{
		std::string name = (*clan)->GetAbbrev();
		CreateFileName(name);
		// делаем клановую доску
		BoardPtr board(new Board);
		board->type = CLAN_BOARD;
		board->name = "ДрВече";
		board->desc = "Основной раздел Дружины ";
		board->desc += (*clan)->GetAbbrev();
		board->clanRent = (*clan)->GetRent();
		board->file = LIB_HOUSE + name + "/" + name + ".board";
		board->Load();
		Board::BoardList.push_back(board);
		// делаем клановые новости
		BoardPtr newsboard(new Board);
		newsboard->type = CLANNEWS_BOARD;
		newsboard->name = "ДрНовости";
		newsboard->desc = "Новости Дружины ";
		newsboard->desc += (*clan)->GetAbbrev();
		newsboard->clanRent = (*clan)->GetRent();
		newsboard->file = LIB_HOUSE + name + "/" + name + "-news.board";
		newsboard->Load();
		Board::BoardList.push_back(newsboard);
	}
}
Exemplo n.º 17
0
void QmitkCreateSimulationAction::Run(const QList<mitk::DataNode::Pointer>& selectedNodes)
{
  mitk::DataNode::Pointer dataNode;

  foreach(dataNode, selectedNodes)
  {
    if (dynamic_cast<mitk::SimulationTemplate*>(dataNode->GetData()) != NULL)
    {
      mitk::SimulationTemplate* simulationTemplate = static_cast<mitk::SimulationTemplate*>(dataNode->GetData());
      std::string contents = simulationTemplate->Bake();

      if (contents.empty())
      {
        MITK_ERROR << "Could not bake simulation template '" << dataNode->GetName() << "'!";
        continue;
      }

      std::string fileName = CreateFileName(dataNode);

      std::ofstream file(fileName.c_str());
      file << contents;
      file.close();

      std::vector<std::string> fileNames;
      fileNames.push_back(fileName);

      mitk::DataNode::Pointer simulationNode = mitk::IOUtil::LoadDataNode(fileName);

      if (simulationNode.IsNotNull())
      {
        m_DataStorage->Add(simulationNode, dataNode);
        InitializeViews(m_DataStorage);
      }
    }
  }
}
Exemplo n.º 18
0
bool CFSCobraDEVIL::Init()
{
	bool res = true;
	byte* dirBuf = new byte[RESERVED_TRACKS * Disk->DiskDefinition.SPT * Disk->DiskDefinition.SectSize];
	for (byte trkIdx = 0; trkIdx < RESERVED_TRACKS && res; trkIdx++)
		res = Disk->ReadTrack(dirBuf + (Disk->DiskDefinition.SPT * Disk->DiskDefinition.SectSize) * trkIdx, 
			trkIdx/2, trkIdx % 2);

	//Initialize dir. entry map.
	for (word dirEntIdx = 0; dirEntIdx < FSParams.DirEntryCount; dirEntIdx++)
		FS_DirEntryMap.push_back(false);

	if (res)
	{
		int dirIdx = 0;
		DirEntryType* dirEnt;
		for (word dirIdx = 0; dirIdx < FSParams.BlockCount; dirIdx++)		
		{
			dirEnt = (DirEntryType*)(dirBuf + (dirIdx * sizeof(DirEntryType)));
			if (dirEnt->Flag != FLAG_DELETE)
			{	
				DEVIL_Dir.push_back(*dirEnt);
				FS_BlockMap.push_back(true);
				FS_DirEntryMap[dirIdx] = true;

				CFileDevil* f = new CFileDevil();
				CreateFileName(dirEnt->Name, f);
				
				if (dirEnt->Flag == FLAG_EXTENT)	
				{
					std::vector<CFileDevil>::iterator it = std::find(DEVIL_FileList.begin(), DEVIL_FileList.end(), *f);
					if (it != DEVIL_FileList.end())
					{
						delete f;
						f = &(*it);
						f->FileDirEntries.push_back(dirIdx);
						f->FileBlocks.push_back(dirIdx);
					}
				}
				else
				{
					f->Length = dirEnt->Length;
					f->FileDirEntries.push_back(dirIdx);					
					f->FileBlocks.push_back(dirIdx);
					f->fs = this;

					f->SpectrumType = (dirEnt->Flag < CFileSpectrum::SPECTRUM_UNTYPED ? (CFileSpectrum::SpectrumFileType)dirEnt->Flag : CFileSpectrum::SPECTRUM_UNTYPED);
					f->SpectrumLength = dirEnt->Length;					
					f->SpectrumStart = dirEnt->Param1;
					if (f->SpectrumType == CFileSpectrum::SPECTRUM_PROGRAM)
						f->SpectrumVarLength = dirEnt->Length - dirEnt->Param2;
					else
						f->SpectrumVarLength = 0;					

					DEVIL_FileList.push_back(*f);

					delete f;
				}					
			}
			else
			{
				FS_BlockMap.push_back(false);
				FS_DirEntryMap[dirIdx] = false;
			}
		}

		
	}

	delete dirBuf;
	return res;
}
Exemplo n.º 19
0
void BeCheckersWindow::MessageReceived(BMessage *message) {
	switch(message->what) {
		case B_ABOUT_REQUESTED:
			AboutRequested(); break;
		case BECHECKERS_NEW:
			if(openedFile != NULL) openedFile = NULL;	// I think there is a small mem leak here??
			StartGame();
			break;
		case BECHECKERS_OPEN: {
			// This is a cludge, because I was too lazy to create another class, but it works ;)
			// Create the open saved game window here

			BRect frame(Frame());
			// The bounds are (0,0,350,125), I hate magic numbers too but oh well.  BeCheckers is full of em!
			openWindow = new BWindow(BRect(frame.left+48, frame.top+40, frame.left+398, frame.top+165),
							 "Saved Games",
							 B_FLOATING_WINDOW_LOOK,B_MODAL_APP_WINDOW_FEEL,
							 B_NOT_RESIZABLE | B_NOT_ZOOMABLE);

			BView *v = new BView(BRect(0, 0, 350, 125), "v", B_NOT_RESIZABLE, B_WILL_DRAW);
			v->SetViewColor(216, 216, 216);

			BButton *b = new BButton(BRect(10, 16, 70, 41), "Open", "Open", new BMessage(BECHECKERS_OPEN_OPEN));
			b->MakeDefault(true);
			b->SetTarget(this);
			v->AddChild(b);

			BButton *b1 = new BButton(BRect(10, 51, 70, 76), "Delete", "Delete", new BMessage(BECHECKERS_OPEN_DELETE));
			b1->SetTarget(this);
			v->AddChild(b1);

			BButton *b2 = new BButton(BRect(10, 86, 70, 111), "Close", "Close", new BMessage(BECHECKERS_OPEN_CLOSE));
			b2->SetTarget(this);
			v->AddChild(b2);

			savedGameList = new BListView(BRect(95, 15, 320, 108), "City");
			SavedGames(savedGameList);	// Get the saved games from disk

			BScrollView *sv = new BScrollView("ScrollView", savedGameList,B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
			v->AddChild(sv);

			openWindow->AddChild(v);
			openWindow->Show();
		} break;
		case BECHECKERS_OPEN_OPEN: {
			int index = savedGameList->CurrentSelection();
			if(index >= 0) {
				// Set seleted file as openedFile and open it
				openedFile = File(((BStringItem *) savedGameList->ItemAt(index))->Text());
				OpenGame(openedFile);
				openWindow->Lock();
				openWindow->Quit();
			}
			else (new BAlert("NoFile",
							 "A saved game must be selected before opening.",
							 "Okay"))->Go();
		} break;
		case BECHECKERS_OPEN_CLOSE:
			openWindow->Lock();
			openWindow->Quit();
			break;
		case BECHECKERS_OPEN_DELETE: {
			int index = savedGameList->CurrentSelection();
			if(index >= 0) {
				// If the file being deleted was the last file opened then set openedFile to (null)
				if(openedFile != NULL && strcmp(File(((BStringItem *) savedGameList->ItemAt(index))->Text()), openedFile) == 0)
					openedFile = NULL;
				// Delete saved game from harddisk
				BEntry entry(File(((BStringItem *) savedGameList->ItemAt(index))->Text()));
				entry.Remove();
				// Delete the filename from the BListView
				openWindow->Lock();
				savedGameList->RemoveItem(index);
				openWindow->Unlock();
			}
			else (new BAlert("NoFile",
							 "A saved game must be selected before deleting.",
							 "Okay"))->Go();
		} break;
		case BECHECKERS_SAVE:
			if(openedFile != NULL) SaveGame(openedFile);
			else this->PostMessage(BECHECKERS_SAVEAS);
			break;
		case BECHECKERS_SAVEAS:
			// Set the new file as the last openedFile and save to harddisk
			openedFile = File(CreateFileName());
			SaveGame(openedFile);
			break;
		case CHECKER_WIN:
			bool color;
			message->FindBool("Color", &color);
			mvIndicationLabel->SetText(color == DARK ? "Dark won" : "Light won");
			if((new BAlert("Winner",
						   color == DARK ? "The dark colored checkers won the game!" :
						   				   "The light colored checkers won the game!",
						   "Quit", "Play again"))->Go() == 0)
				 be_app->PostMessage(B_QUIT_REQUESTED);
			else this->PostMessage(BECHECKERS_NEW);
			break;
		case CHECKER_TURN:
			bool turn;
			message->FindBool("Turn", &turn);
			mvIndicationLabel->SetText(turn == DARK ? "Dark to move" : "Light to move");
			break;
		default:
			BWindow::MessageReceived(message); break;
	}
}
    void BackupMetadataFileTests::EndTest()
    {
        prId_.Reset();
    }

    BOOST_FIXTURE_TEST_SUITE(BackupMetadataFileTestSuite, BackupMetadataFileTests);

    //
    // Scenario:        Write the backup metadata file and read the file
    // Expected Result: The properties read from file should as expected
    // 
    BOOST_AUTO_TEST_CASE(BackupMetadataFile_WriteAndRead)
    {
        TEST_TRACE_BEGIN("BackupMetadataFile_WriteAndRead")
        {
            KString::CSPtr fileName = CreateFileName(L"BackupMetadataFile_WriteAndRead.txt", allocator);

            SyncAwait(Test_BackupMetadataFile_WriteAndRead(*fileName));
        }
    }

    //
    // Scenario:        BackupMetadataFile Equal function test
    // Expected Result: Same BackupMetadataFile should return true, different BackupMetadataFiles should return false
    // 
    BOOST_AUTO_TEST_CASE(BackupMetadataFile_Equal)
    {
        TEST_TRACE_BEGIN("BackupMetadataFile_Equal")
        {
            KString::CSPtr fileName = CreateFileName(L"BackupMetadataFile_Equal.txt", allocator);
Exemplo n.º 21
0
int32
CmtFat::CreateDirectory( cpchar dirName ) {
  FatDirEntry1x *ptr = 0;
  devLock();
  //Открыть для записи
  ptr = FindFile( dirName );
  //Если уже существует, то невозможно создать
  if( ptr ) {
    devUnLock();
    return CMTE_FS_DIR_PRESENT;
    }
  uint32 subDir = 0; //Обозначение кластера директория верхнего уровня
  GetSubDir( dirName, &subDir );
  ptr = CreateFileName( dirName );
  if( ptr ) {
    //Обозначить как директорий
    ptr->mAttrib = FA_DIRECTORY;
    uint16 time = ptr->mCreationTime;
    uint16 date = ptr->mCreationDate;
    uint32 cluster = ptr->GetFirstCluster32();

    //Инициализировать кластер
    InitDirCluster( cluster );

    //Сформировать пустой директорий

    //Заполнить начальные записи директория
    ptr = GetDirRecord( SectorFromCluster(cluster), 0 );
    memcpy( ptr->mFileName, ".          ", 11 );
    ptr->mAttrib = FA_DIRECTORY;
    ptr->mReserved[0] = ptr->mReserved[1] = 0;
    ptr->mUpdateTime =     //time create/update
    ptr->mCreationTime = time;
    ptr->mUpdateDate =     //date create/update
    ptr->mAccessDate =
    ptr->mCreationDate = date;
    ptr->mFirstClusterHigh = 0; // higher
    ptr->mFileSize = 0;
    ptr->SetFirstCluster32( cluster );

    //Объявить сектор грязным
    dirtyDirSector = 1;

    ptr = GetDirRecord( curDirSector, 1 );
    memcpy( ptr->mFileName, "..         ", 11 );
    ptr->mAttrib = FA_DIRECTORY;
    ptr->mReserved[0] = ptr->mReserved[1] = 0;
    ptr->mUpdateTime =     //time create/update
    ptr->mCreationTime = time;
    ptr->mUpdateDate =     //date create/update
    ptr->mAccessDate =
    ptr->mCreationDate = date;
    ptr->mFirstClusterHigh = 0; // higher
    ptr->mFileSize = 0;
    ptr->SetFirstCluster32( subDir );

    //Объявить сектор грязным
    dirtyDirSector = 1;

    devUnLock();
    return CMTE_OK;
    }
  devUnLock();
  return CMTE_FAIL;
  }
INT32 FSUpdateStorage::Create( MFUpdateHeader& storageHeader, UINT32 flags )
{
    INT32 newHandle = -1, i, cntWrite;
    FSUpdateHeader header;
    MFUpdateHeader hdr;
    FSUpdateFile* pFile;
    INT64 position = 0;
    header.fileSignature = c_FileSignature;

    if(!g_FSUpdateStorage.m_initialized) g_FSUpdateStorage.InitializeFiles();

    INT32 updateSizeTotal = storageHeader.UpdateSize + sizeof(header);

    // If we are creating a new deployment we should erase any other of the same type 
    Delete( MFUPDATE_UPDATEID_ANY, storageHeader.UpdateType, MFUPDATE_UPDATESUBTYPE_ANY );

    for(i=0; i<ARRAYSIZE(g_FSUpdateStorage.m_files); i++)
    {
        if( g_FSUpdateStorage.m_files[i].Type    == storageHeader.UpdateType    && 
            g_FSUpdateStorage.m_files[i].SubType == storageHeader.UpdateSubType && 
            g_FSUpdateStorage.m_files[i].ID      == storageHeader.UpdateID      && 
            g_FSUpdateStorage.m_files[i].Size    != 0 )
        {
            return -1;
        }
    }
    
    memcpy(&header.storageHeader, &storageHeader, sizeof(header.storageHeader));

    newHandle = g_FSUpdateStorage.GetFreeHandle();

    if(newHandle == -1) return -1;

    pFile = &g_FSUpdateStorage.m_files[newHandle];

    if(!CreateFileName(storageHeader.UpdateID, storageHeader.UpdateType, pFile->FilePath, sizeof(pFile->FilePath)))
    {
        return -1;
    }

    if(FAILED(g_FSUpdateStorage.m_defaultVolume->Open((LPCWSTR)pFile->FilePath, &pFile->Handle)))
    {
        return -1;
    }

    pFile->Volume       = g_FSUpdateStorage.m_defaultVolume;
    pFile->ID           = storageHeader.UpdateID;
    pFile->Type         = storageHeader.UpdateType;
    pFile->SubType      = storageHeader.UpdateSubType;
    pFile->Size         = updateSizeTotal;

    pFile->Volume->SetLength(pFile->Handle, updateSizeTotal);

    if(FAILED(pFile->Volume->Seek(pFile->Handle, 0, SEEKORIGIN_BEGIN, &position)))
    {
        return -1;
    }

    if(FAILED(pFile->Volume->Write(pFile->Handle, (BYTE*)&header, sizeof(header), &cntWrite) || cntWrite == 0))
    {
        pFile->Volume->Close (pFile->Handle);
        pFile->Volume->Delete((LPCWSTR)pFile->FilePath);

        memset(pFile, 0, sizeof(*pFile));

        return -1;
    }
    
    pFile->Volume->Flush(pFile->Handle);
    
    return newHandle;
}
Exemplo n.º 23
0
UI32 CSWF::SaveFrameAsSVG(UI16 usClipID, UI16 usFrame)
{
	FILE *pfileSVG;
	char szSVGFileName[MAX_FILEPATH], szID[256];
	double sdXMin, sdXMax, sdYMin, sdYMax, sdWidth, sdHeight;
	void **lprgvpTagArray;
	UI32 ulNumTags, ulStart;
	UI16 usFrameCount=0;
	UNKNOWNTAG* lputTag;
	SHOWFRAME *lpsfShowFrame;
	DEFINESHAPE *lpdsShape;
	CDisplayList cdlDisplayList;
	LAYER lLayer;

	if(!GetTagArray(usClipID,lprgvpTagArray,ulNumTags))
		return -1;	

	/*dimension calculations*/
	sdXMin=double(fhFrameHeader.srFrameSize.slXMin)/20;
	sdXMax=double(fhFrameHeader.srFrameSize.slXMax)/20;
	sdYMin=double(fhFrameHeader.srFrameSize.slYMin)/20;
	sdYMax=double(fhFrameHeader.srFrameSize.slYMax)/20;
	sdWidth=sdXMax-sdXMin;
	sdHeight=sdYMax-sdYMin;

	/*open file*/
	CreateFileName(szSVGFileName,"frame",usFrame,"svg");
	pfileSVG=fopen(szSVGFileName,"w");
	
	/*info*/
	fprintf(pfileSVG,"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
	fprintf(pfileSVG,"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n");
	fprintf(pfileSVG,"\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg11.dtd\">\n\n");
	fprintf(pfileSVG,"<!-- Generated by SWFRIP -->\n\n");
	
	/*svg*/
	fprintf(pfileSVG,"<svg width=\"%0.2f\" height=\"%0.2f\" viewBox=\"%0.2f %0.2f %0.2f %0.2f\">\n\n",
			sdWidth,sdHeight,sdXMin,sdYMin,sdWidth,sdHeight);

	/*frame*/
	//fprintf(pfileSVG,"<!-- Frame %i -->\n\n",usFrame);
	//fprintf(pfileSVG,"<g id=\"frame_%i\">\n\n",usFrame);

	/*generate display list*/
	for(UI32 iTag=0; usFrameCount<usFrame && iTag<ulNumTags; iTag++)
	{
		lputTag=(UNKNOWNTAG*)lprgvpTagArray[iTag];

		switch(lputTag->rhTagHeader.usTagCode)
		{
			case TAGCODE_PLACEOBJECT:
			case TAGCODE_PLACEOBJECT2:
				cdlDisplayList.Place(lputTag);
				break;

			case TAGCODE_REMOVEOBJECT:
			case TAGCODE_REMOVEOBJECT2:
				cdlDisplayList.Remove(lputTag);
				break;

			case TAGCODE_SHOWFRAME:
				usFrameCount++;
				break;
		}
	}

	/*make frame*/
	while(cdlDisplayList.GetNextLayer(&lLayer))
	{
		if(GetCharacterType(lLayer.po2Place.usCharacterID)!=SWF_SHAPE) continue;

		lpdsShape=(DEFINESHAPE*)lprgvpCharacters[lLayer.po2Place.usCharacterID];
		//WriteDefineShapeAsSVG(lpdsShape,false,pfileSVG);
		
		/*save character*/
		//SetExportFormat(SWF_SHAPE,1);
		//SaveCharacter(lLayer.po2Place.usCharacterID);
				
		/*write color transform filter*/
		if(lLayer.po2Place.fPlaceFlagHasColorTransform)
		{
			sprintf(szID,"color_transform_%p",lLayer.lplNext);
			WriteColorMatrixFilter(&lLayer.po2Place.cxfwaColorTransform,szID,pfileSVG);
			fprintf(pfileSVG,"<g filter=\"url(#%s)\">\n",szID);
		}

		/*write image*/	
		/*fprintf(pfileSVG,"<image x=\"%.2f\" y=\"%.2f\"",
				double(lpdsShape->rShapeBounds.slXMin)/20,
				double(lpdsShape->rShapeBounds.slYMin)/20);

		fprintf(pfileSVG," width=\"%.2f\" height=\"%.2f\"",
				double(lpdsShape->rShapeBounds.slXMax-lpdsShape->rShapeBounds.slXMin)/20,
				double(lpdsShape->rShapeBounds.slYMax-lpdsShape->rShapeBounds.slYMin)/20);
		*/

		//fprintf(pfileSVG,"<use xlink:href=\"#shape_%i\"",lpdsShape->usShapeID);

		/*inline
		if(lLayer.po2Place.fPlaceFlagHasColorTransform)
			fprintf(pfileSVG," filter=\"url(#color_transform_%p)\"",lLayer.lplNext);
		*/

		/*if(lLayer.po2Place.fPlaceFlagHasMatrix)
			WriteTransform(&lLayer.po2Place.mMatrix,pfileSVG);
		
		fprintf(pfileSVG," />\n");
		*/
		WriteDefineShapeAsSVG(lpdsShape,true,pfileSVG,&lLayer.po2Place);

		if(lLayer.po2Place.fPlaceFlagHasColorTransform)
			fprintf(pfileSVG,"</g>\n");
		
		fprintf(pfileSVG,"\n");

	}
	
	/*end file*/
	//fprintf(pfileSVG,"</g>\n\n");
	fprintf(pfileSVG,"</svg>");
	fclose(pfileSVG);

	/*so that szLastRes is this frame*/
	CreateFileName(szSVGFileName,"frame",usFrame,"svg");

	return 0;
}
Exemplo n.º 24
0
LRESULT CRecordSound::OnStartRecording(WPARAM wParam, LPARAM lParam)
{
	DWORD mmReturn = 0;

	if(m_bRecording)
		return FALSE;

	if(!m_bRecording)
	{
		// open wavein device
		MMRESULT mmReturn = ::waveInOpen( &m_hRecord, WAVE_MAPPER,
			&m_WaveFormatEx, ::GetCurrentThreadId(), 0, CALLBACK_THREAD);
		if(mmReturn)
		{
			char errorbuffer[MAX_PATH];
			char errorbuffer1[MAX_PATH];
			waveInGetErrorText( mmReturn, 
								errorbuffer,
								MAX_PATH);
			sprintf(errorbuffer1,"WAVEIN:%x:%s",mmReturn,errorbuffer);

			AfxMessageBox(errorbuffer1);  

		}
	
			
		if(!mmReturn)
		{
			for(int i=0; i < m_nMaxInputBuffers; i++)
			{
				LPWAVEHDR lpHdr = CreateWaveHeader();
				mmReturn = ::waveInPrepareHeader(m_hRecord,lpHdr, sizeof(WAVEHDR));
				mmReturn = ::waveInAddBuffer(m_hRecord, lpHdr, sizeof(WAVEHDR));
				m_nInputBuffers++;
			}
			mmReturn = ::waveInStart(m_hRecord);
			if(mmReturn )
		{
			char errorbuffer[MAX_PATH];
			char errorbuffer1[MAX_PATH];
			waveInGetErrorText( mmReturn, 
								errorbuffer,
								MAX_PATH);
			sprintf(errorbuffer1,"WAVEIN:%x:%s",mmReturn,errorbuffer);

			AfxMessageBox(errorbuffer1);  

		}
	
			if(!mmReturn)
			{
				m_bRecording = TRUE;
				if(m_Player)
					m_Player->PostThreadMessage(WM_PLAYSOUND_STARTPLAYING, 0, 0);				
					if(m_Writer)
					{
						char SendFileName[MAX_PATH];
						memset(SendFileName,0,MAX_PATH*sizeof(char));
						pwsf= (PWRITESOUNDFILE) new WRITESOUNDFILE;
						ZeroMemory(pwsf,sizeof(WRITESOUNDFILE));
						char *p = pwsf->lpszFileName;
						CString strdir,fullname;
						strdir.Format("%sXMTvoice",XMTVoiceFile.m_Path);
						CreateFileName(strdir.GetBuffer(0),".wav",SendFileName);
						strcpy(p,SendFileName);
						memcpy(&pwsf->waveFormatEx,&m_WaveFormatEx,sizeof(m_WaveFormatEx));
						m_Writer->PostThreadMessage(WM_WRITESOUNDFILE_FILENAME,0,(LPARAM)pwsf);
					}
		
				return ERROR_SUCCESS;
			}
		}
	

	}
	return TRUE;
}
Exemplo n.º 25
0
//*****************************************************************************
//
// This is called at the start of logging to open a file on the storage
// device in preparation for saving data.  If no file name is specified, then
// a new file will be created.
//
// If a file name is specified, then that will be used instead of searching
// for an available file.  The file name that is passed in must be a maximum
// of 8 characters (9 including trailing 0) and represents the first part of
// the file name not including the extension.
//
// The function returns a pointer to the first part of the file name
// (without file extension).  It can be up to 8 characters (9 including the
// trailing 0).  If there is any error then a NULL pointer is returned.
//
//*****************************************************************************
char *
USBStickOpenLogFile(char *pcFilename8)
{
    FRESULT iFResult;
    uint32_t ui32BytesWritten;
    static char pcFilename[16];
    uint32_t ui32Len;

    //
    // Check state for ready device
    //
    g_ui32Flags &= ~FLAGS_FILE_OPENED;
    if(g_iState == eSTATE_DEVICE_READY)
    {
        //
        // If a file name is specified then open that file
        //
        if(pcFilename8 && pcFilename8[0])
        {
            //
            // Copy the filename into local storage and cap at 8 characters
            // length.
            //
            memcpy(pcFilename, pcFilename8, 8);
            pcFilename[8] = 0;

            //
            // Find the actual length of the string (8 chars or less) so we
            // know where to add the extension.
            //
            ui32Len = strlen(pcFilename);

            //
            // Add the extension to the file name.
            //
            usnprintf(&pcFilename[ui32Len], 5, ".CSV");
        }

        //
        // Otherwise no file name was specified so create a new one.
        //
        else
        {
            if(CreateFileName(pcFilename, sizeof(pcFilename)))
            {
                //
                // There was a problem creating a file name so return an error
                //
                return(0);
            }
        }

        //
        // Open the file by name that was determined above.  If the file exists
        // it will be opened, and if not it will be created.
        //
        iFResult = f_open(&g_sFileObject, pcFilename, (FA_OPEN_ALWAYS |
                                                      FA_WRITE));
        if(iFResult != FR_OK)
        {
            return(0);
        }

        //
        // Since it is possible that the file already existed when opened,
        // seek to the end of the file so new data will be appended.  If this
        // is a new file then this will just be the beginning of the file.
        //
        iFResult = f_lseek(&g_sFileObject, g_sFileObject.fsize);
        if(iFResult != FR_OK)
        {
            return(0);
        }

        //
        // Set flag to indicate file is now opened.
        //
        g_ui32Flags |= FLAGS_FILE_OPENED;

        //
        // If no file name was specified, then this is a new file so write a
        // header line with column titles to the CSV file.
        //
        if(!pcFilename8 || !pcFilename8[0])
        {
            //
            // Write a header line to the CSV file
            //
            iFResult = f_write(&g_sFileObject, g_pcCSVHeaderLine,
                              sizeof(g_pcCSVHeaderLine), &ui32BytesWritten);
            if(iFResult != FR_OK)
            {
                g_ui32Flags &= ~FLAGS_FILE_OPENED;
                return(0);
            }

            //
            // Since no file name was specified that means a file name was
            // created.  Terminate the new file name at the '.' separator
            // and return it to the caller.  We know that created file names
            // are always 7 characters.  Return the newly created file name
            // (the part before the '.')
            //
            pcFilename[7] = 0;
            return(pcFilename);
        }

        //
        // Otherwise, a file name was specified, so no need to write a
        // header row.  The caller's file name is unchanged so return the
        // same value back.
        //
        else
        {
            return(pcFilename8);
        }
    }

    else
    {
        //
        // Device not ready so return NULL.
        //
        return(0);
    }
}