I need C++ help

CyberCowboy

Senior member
Apr 16, 2001
247
0
0
how do you do the following in C++?
I would search on google for these, but I can't find anything.

1. How do i write a program that takes output from another program?
(for example, how would i write a program that would run the dos version of ping and take the resulting output for parsing in my program).

2. how do i retrieve a listing of directory contents. (i.e. how do i figure what folders and files are available on the hard drive)?

3. how do i work with individual bits? (i.e. if I have the bit string 10011011, how would i convert that to 10110110)? Is it even possible with C++?

ok.. i had more, but I forgot what they were. if you can just lead me to a tutorial, give me some keywords for search, or just tell me how... then that would be greatly appreciated.

 

SigEpUCI

Member
Feb 2, 2001
31
0
0
YOu would have more luck posting on the forums at:

www.codeguru.com
or
www.codeproject.com

1) Look up shellexecute on MSDN. You could execute the process from another process, pipe the output of the second process to a file, and parse it out later.

2) Look up FindFile or FindNextFile on MSDN.. Lets you enumerate the contents of directory.

3) use the bit shift operators << and >> or multiplication

to insert a zero from the right, multiply by 2
to insert a one from the right, multiply by 2 and add 1