mb_load_string

Previous  Next

 

status_t mb_load_string( mb_interpreter_t* s, const char* pBuffer )

 


 

Loads a string containing source code into the interpreter.  The mb_load_file/mb_load_file_ex calls this function after it has read the source file into a buffer.  You can call this function instead of mb_load_file/mb_load_file_ex if you want to read the source code from some other source than a file or if you want to do your own file handling.

 

Example

 

if ( mb_reset( &m_bas, false ) == MB_FUNC_OK )

{

  if ( mb_load_string( m_bas, strLine ) == MB_FUNC_OK )

  {

     // Prevent Application from exiting while running script

     SetNoExit( TRUE );

 

     // Set Run-Time Environment

     mb_set_environment( m_bas, m_nRunTimeEnvironment );

 

     // Run the Script

     bRetStat = mb_run( m_bas ) == MB_FUNC_OK;

 

     // We can exit now...

     SetNoExit( FALSE );

  }

}