Configuring without Commandline Options

Top  Previous  Next

Here is a complete example that shows  to set default initial options not using commandline.

 

//---------------------------------------------------------------------------

// JrDebug simplest demo

//---------------------------------------------------------------------------

 

//---------------------------------------------------------------------------

// System includes for std::cout usage below

#include <iostream>

//---------------------------------------------------------------------------

 

//---------------------------------------------------------------------------

// Include the Debugging Library file (only our main should include this

//  file, additional .cpp files should include "jrdebug.h"

//  alternatively, you could add this cpp to your project or makefile.

#include "../../jrdebug_main.cpp"

//---------------------------------------------------------------------------

 

 

//---------------------------------------------------------------------------

int main(int argc, char *argv[])

{

 // set our own commandline options as one big string, not using actual comline args

 JrDebug::ParseCommandlineArgString("-dbo text;debugout.txt",NULL,false);

 

 // C++ iostreams style logging:

 debugout << "Main started with argc = "<<argc;

 // printf style logging:

 dbprintf("Main started with argc=%d",argc);

 

 // return success

 std::cout << "Program has finished; if you were running the debug monitor you should have seen 2 messages."<<std::endl;

 return 0;

}

//---------------------------------------------------------------------------