c++ program for type command

September 1, 2010 at 23:43:41
Specs: Windows XP, Intel/1gb
Sir, I am facing a problem in c/c++, I am not getting the code for the "TYPE" command in DOS.

See More: c++ program for type command

Report •

September 2, 2010 at 20:14:57
dunno what the source for type is, but you can spoof what it does by parsing the command line arguments.

int main(int argc, char *argv[]) { .. }

For example:

my_type argc = 1
my_type somefile (takes somefile as an input file) argc = 2
my_type somefile | more (pause the output of somefile) argc = 4
my_type somefile > outfile (rewrites somefile as outfile) argc = 4
my_type "somefile > outfile" (same as above, but in one argument) argc = 2

argv[1] through argv[argc - 1] would be your command line args to process when argc >= 2.

where my_type would be the name of your executable. Something like that, I guess.


I have no aspiration for preaching. ;-)

Report •
Related Solutions

Ask Question