MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / ConfigSave_BufferToDisk

Function ConfigSave_BufferToDisk

source/Debugger/Debug.cpp:2997–3032  ·  view source on GitHub ↗

===========================================================================

Source from the content-addressed store, hash-verified

2995
2996//===========================================================================
2997bool ConfigSave_BufferToDisk ( const char *pFileName, ConfigSave_t eConfigSave )
2998{
2999 bool bStatus = false;
3000
3001 char sModeCreate[] = "w+t";
3002 char sModeAppend[] = "a+t";
3003 char *pMode = NULL;
3004 if (eConfigSave == CONFIG_SAVE_FILE_CREATE)
3005 pMode = sModeCreate;
3006 else
3007 if (eConfigSave == CONFIG_SAVE_FILE_APPEND)
3008 pMode = sModeAppend;
3009
3010 const std::string sFileName = g_sCurrentDir + pFileName; // TODO: g_sDebugDir
3011
3012 FILE *hFile = fopen( pFileName, pMode );
3013
3014 if (hFile)
3015 {
3016 const int nLine = g_ConfigState.GetNumLines();
3017
3018 for ( int iLine = 0; iLine < nLine; iLine++ )
3019 {
3020 const char *pText = g_ConfigState.GetLine( iLine );
3021 if ( pText )
3022 {
3023 fputs( pText, hFile );
3024 }
3025 }
3026
3027 fclose( hFile );
3028 bStatus = true;
3029 }
3030
3031 return bStatus;
3032}
3033
3034
3035//===========================================================================

Callers 2

CmdBookmarkSaveFunction · 0.85
CmdBreakpointSaveFunction · 0.85

Calls 2

GetNumLinesMethod · 0.80
GetLineMethod · 0.45

Tested by

no test coverage detected