Capture Results from System()?
| maximusava (5) | |||
| Hello, I am trying to write a basic program that searches a user's hard drive for PST files. Once the program finds the files, I would like to be able to use that data to copy the files to another location. So far, my program can find the files I am looking for...but I have not been able to figure out how to capture the information from the system so that I can setup a copy command? Does anyone have any thoughts or suggestions? Thanks in advance!
| |||
| Hotaru (31) | |||
| You should consider using a .bat file instead of a C++ program. If you install Cygwin, you can use find, xargs, and cp to do the whole job with a single line. (The find.exe that is part of Cygwin is different from the find.exe that is part of DOS and Windows.) If you want to stay with C++ anyway, change string findPST = "dir c:\\ /s /b | find \".pst\""; to string findPST = "dir c:\\ /s /b | find \".pst\" >temp.tmp"; Then you must read back temp.tmp, copy your files, and delete temp.tmp at the end. | |||
This topic is archived - New replies not allowed.
