Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem in using system()

Problem in using system()

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comtoolsquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nandu_77b
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • N Nandu_77b

      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

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      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. <

      N S 2 Replies Last reply
      0
      • C Code o mat

        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. <

        N Offline
        N Offline
        Nandu_77b
        wrote on last edited by
        #3

        In system() function i am using "\". But this is not the problem.

        1 Reply Last reply
        0
        • C Code o mat

          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. <

          S Offline
          S Offline
          sashoalm
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups