Getting Started Coding

From FarsightWiki
Revision as of 20:05, 19 August 2011 by Ripan Sarkar (Talk | contribs)
Jump to: navigation, search

Learning Coding

The basis of Farsight is the C++ libraries used.

Places to find documentation and example code:

A Simple Main Function

 
//first include some source classes
#include "SomeReaderClass.h"  
#include "SomeWriterClass.h"
//main function takes in arguments from the command line
int main(int argc,  char **argv )
{
  // argc is a int to tell you how many input arguments were included.
  // argv is a char pointer pointer of the input arguments. 
  for ( int i = 0; i < argc; i++)
  {
    // starting from 0, the index variable "i" will increase until it is argc -1
    // c++ counts from 0, so index array[2] is a the third place in array {0,1,2}
    std::cout <<"argument at" << i << " is " <<argv[i] << std::endl;
    // this loop will print out the arguments including the .exe name
  }
  return 0; //the main function exits
}
Personal tools