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

Method Read

source/Debugger/Util_MemoryTextFile.cpp:35–60  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

33
34//===========================================================================
35bool MemoryTextFile_t::Read( const std::string & pFileName )
36{
37 bool bStatus = false;
38 FILE *hFile = fopen( pFileName.c_str(), "rb" );
39
40 if (hFile)
41 {
42 fseek( hFile, 0, SEEK_END );
43 long nSize = ftell( hFile );
44 fseek( hFile, 0, SEEK_SET );
45
46 m_vBuffer.reserve( nSize + 1 );
47 m_vBuffer.insert( m_vBuffer.begin(), nSize+1, 0 ); // NOTE: Can NOT m_vBuffer.clear(); MUST insert() _before_ using at()
48
49 char *pBuffer = & m_vBuffer.at(0);
50 fread( (void*)pBuffer, nSize, 1, hFile );
51 fclose(hFile);
52
53 m_bDirty = true;
54 GetLinePointers();
55
56 bStatus = true;
57 }
58
59 return bStatus;
60}
61
62
63//===========================================================================

Callers 3

CmdSymbolsLoadFunction · 0.45
CmdOutputRunFunction · 0.45
BufferAssemblyListingFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected