HTTrack Website Copier
Free software offline browser - FORUM
Subject: hts_main() args in C
Author: Leto
Date: 08/03/2005 08:06
 
I recently noticed the libtest code!  Good stuff, but I'm not good at C and am
trying to understand the code.

So hts_main(int argc, char **argv) takes two parameters.  argc is a count of
the execution arguments, right?  What is argv?  An array of strings (I presume
"char*" means array of chars, ie string type) of those arguments?
So in the code below is argc=5 and argv is populated with the values but then
the last value is made NULL?  Is that different to an empty string in C?

  char _argv[][256] = {"httrack_test" , "<URL>" , "-r3" , "--testscan" , "" 
};
  char* argv[]      = {NULL           , NULL    , NULL  , NULL        ,
NULL};
  int         argc = 0;
  while(strlen(_argv[argc])) {
    argv[argc]=_argv[argc];
    argc++;
  }
  argv[argc]=NULL;
 
Reply


All articles

Subject Author Date
hts_main() args in C

08/03/2005 08:06
Re: hts_main() args in C

08/04/2005 00:00




2

Created with FORUM 2.0.11