Converting console application to GUI
I found a C++ code to convert Latitude/Langitude to UTM coordinate. The code is [here][1]. I would like to use .NET GUI (windows Forms) instead of the console screen. Now instead of entering the value `22.2 33.3` for example in console, I would read it from a `textBox`. and then call the conversion function. The problem that I faced is I don't know what parameters should I pass to the function `CvtLine(int C, char**V, char*p)` which is called from the main function of console application:

    int main(int argc, char**argv){							//2010-08-11: was void main(...
       char buf[256]; char*p; int L,ac; char*av[129];				//vars for reading stdin
       cout<<setiosflags(ios::fixed);						//decided against including ios::showpoint
       Fmt=fUT4|fLLD|fLLDM;								//default for Fmt, if not specified by input
       --argc; ++argv;								//remove spurious first element of argv array
       while(argc && memcmp(argv[0],"--",2)==0){					//handle leading options: --Outputformat, --test, --help
          if     (isdigit(argv[0][2]))		Fmt=atoi(argv[0]+2);		//for --<DIGIT>, parse Outputformat into Fmt
          else if(strcmp(argv[0],"--test")==0)	{Testcases(); return 0;}	//for --test, run testcases & exit
          else					{Usage(); return 0;}		//for --help, show Usage & exit
          --argc; ++argv;
       }
       if(argc==0)  while(cin.getline(buf,256), cin.good()){			//0 args, read stdin converting each line
          p=buf; ac=0;
          while(1){ while(*p&&strchr(" \t",*p))++p; if(*p==0||*p=='#')break; av[ac++]=p; while(*p&&!strchr(" \t#",*p))++p;}	//break line into whitespace-separated words
          if(ac>=2&&ac<=4) CvtLine(ac,av,p);					//line with 2|3|4 words, convert and print
          else if(ac==0)   cout<<buf<<"\n";						//line with no words, echo the line (comments)
          else             cout<<"==invalid number-of-words: "<<buf<<"\n";		//anything else is invalid, produce errmsg
       }
       else if(argc>=2&&argc<=4)	CvtLine(argc,argv,"");				//2|3|4 args, convert and print
       else				Usage();					//argc other than 0|2|3 is invalid, show Usage
       return 0;									//2010-08-11: added when void became illegal
    }

  [1]: http://ereimer.net/programs/LatLong-UTM.cpp



Converting console application to GUI
===

I found a C++ code to convert Latitude/Langitude to UTM coordinate. The code is [here][1]. I would like to use .NET GUI (windows Forms) instead of the console screen. Now instead of entering the value `22.2 33.3` for example in console, I would read it from a `textBox`. and then call the conversion function. The problem that I faced is I don't know what parameters should I pass to the function `CvtLine(int C, char**V, char*p)` which is called from the main function of console application:

    int main(int argc, char**argv){							//2010-08-11: was void main(...
       char buf[256]; char*p; int L,ac; char*av[129];				//vars for reading stdin
       cout<<setiosflags(ios::fixed);						//decided against including ios::showpoint
       Fmt=fUT4|fLLD|fLLDM;								//default for Fmt, if not specified by input
       --argc; ++argv;								//remove spurious first element of argv array
       while(argc && memcmp(argv[0],"--",2)==0){					//handle leading options: --Outputformat, --test, --help
          if     (isdigit(argv[0][2]))		Fmt=atoi(argv[0]+2);		//for --<DIGIT>, parse Outputformat into Fmt
          else if(strcmp(argv[0],"--test")==0)	{Testcases(); return 0;}	//for --test, run testcases & exit
          else					{Usage(); return 0;}		//for --help, show Usage & exit
          --argc; ++argv;
       }
       if(argc==0)  while(cin.getline(buf,256), cin.good()){			//0 args, read stdin converting each line
          p=buf; ac=0;
          while(1){ while(*p&&strchr(" \t",*p))++p; if(*p==0||*p=='#')break; av[ac++]=p; while(*p&&!strchr(" \t#",*p))++p;}	//break line into whitespace-separated words
          if(ac>=2&&ac<=4) CvtLine(ac,av,p);					//line with 2|3|4 words, convert and print
          else if(ac==0)   cout<<buf<<"\n";						//line with no words, echo the line (comments)
          else             cout<<"==invalid number-of-words: "<<buf<<"\n";		//anything else is invalid, produce errmsg
       }
       else if(argc>=2&&argc<=4)	CvtLine(argc,argv,"");				//2|3|4 args, convert and print
       else				Usage();					//argc other than 0|2|3 is invalid, show Usage
       return 0;									//2010-08-11: added when void became illegal
    }

  [1]: http://ereimer.net/programs/LatLong-UTM.cpp


