S
H
A
R
E

Wednesday, January 26, 2011

C++, Get all parameter there was sent by (DOS/CMD Mode)

#include
#define uli unsigned long int
/*
 Get all parameter there was sent by (DOS/CMD Mode)
  ex :
          jal.exe -this is
  Then the parameter is:
-this is
*/
void main(int arc, char *ar[])
{
// arc:count of parameter(split with space)
// ar: 2D array include string parameter
int n=0,i;
char cmd[255]; //maksimal argument
char *cek = ar[1];
for (int j=1;j
   i=0;
    do{
        cmd[n] = ar[j][i];
       i++; n++;
   }while(ar[j][i]!=0);
cmd[n]=' ';
n++;
};
cmd[n]='\0'; //null terminated string
//Show All Parameter command
cout << "----------------------\nparameter: "<< cmd << '\n';
}
// by: Klampok_Child@yahoo.co.id


Read More!

TPW StrToInt IntToStr

function StrToInt(s:char):integer ;
begin
StrToInt := ord(s)-48;
end;

function IntToStr(ii : longint): string;
var s : string[30];
begin
    str(ii, s);
    IntToStr := s;
end;
Read More!