Problem in using system()
-
Is there any way to perform "TOUCH" (like TOUCH in UNIX) in windows, with out installing any tools? From the site : "http://support.microsoft.com/kb/69581, I came to know that we can use COPY command to perform TOUCH like operation. and tried the below command. but I got the error "The system cannot find the file specified." system ( "/COPY C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt /B +"); So please help to fix this. Below are the different options I tried, but no clue. 1) I Have executed the below command from command prompt it works fine. C:\Documents and Settings\ms56106\.tdm> COPY /B "C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt" + 1 file(s) copied. And if try the same from different folder it fails, C:\Documents and Settings\ms56106> COPY /B "C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt" + The system cannot find the file specified. 0 file(s) copied. What should I do to run for a different folder? 2) I want the same command to be used in C++ source, for this I tried the same with system(), but it is not working. Please correct me. tem = C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt system ( "/COPY tem /B +"); Thanks, Nandu
-
Is there any way to perform "TOUCH" (like TOUCH in UNIX) in windows, with out installing any tools? From the site : "http://support.microsoft.com/kb/69581, I came to know that we can use COPY command to perform TOUCH like operation. and tried the below command. but I got the error "The system cannot find the file specified." system ( "/COPY C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt /B +"); So please help to fix this. Below are the different options I tried, but no clue. 1) I Have executed the below command from command prompt it works fine. C:\Documents and Settings\ms56106\.tdm> COPY /B "C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt" + 1 file(s) copied. And if try the same from different folder it fails, C:\Documents and Settings\ms56106> COPY /B "C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt" + The system cannot find the file specified. 0 file(s) copied. What should I do to run for a different folder? 2) I want the same command to be used in C++ source, for this I tried the same with system(), but it is not working. Please correct me. tem = C:/Documents and Settings/ms56106/.tdm/CookieSession_Details.txt system ( "/COPY tem /B +"); Thanks, Nandu
Shouldn't you be using \ instead of / in the paths? Like, "C:\Documents and Settings\ms56106..." instead of "C:/Documents and Settings/ms56106..."? Don't know if that makes any difference though...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
Shouldn't you be using \ instead of / in the paths? Like, "C:\Documents and Settings\ms56106..." instead of "C:/Documents and Settings/ms56106..."? Don't know if that makes any difference though...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
-
Shouldn't you be using \ instead of / in the paths? Like, "C:\Documents and Settings\ms56106..." instead of "C:/Documents and Settings/ms56106..."? Don't know if that makes any difference though...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
All WIN32 API functions all accept both '/' and '\' (for NT at least), only some old command-line tools written for DOS might give you a problem there.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal