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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. need delete a file in vc++

need delete a file in vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
3 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.
  • K Offline
    K Offline
    kamalilam
    wrote on last edited by
    #1

    hi, i want to know that,how to delete a particuler file using a path in vc++ i knew that DeleteFile() ,resolve it...but i have a piece of code ..will show below..can u give me the solution .. i stored the path in Dir, Dir = "d:\testapp\abc.exe" now delete a file: deletefile(Dir);//if i take path like this then this function will delete it. //("d:\\testapp\\abc.exe") now i want to delete this file using single slash("\") inside path.. anybody know???

    K J 2 Replies Last reply
    0
    • K kamalilam

      hi, i want to know that,how to delete a particuler file using a path in vc++ i knew that DeleteFile() ,resolve it...but i have a piece of code ..will show below..can u give me the solution .. i stored the path in Dir, Dir = "d:\testapp\abc.exe" now delete a file: deletefile(Dir);//if i take path like this then this function will delete it. //("d:\\testapp\\abc.exe") now i want to delete this file using single slash("\") inside path.. anybody know???

      K Offline
      K Offline
      KingsGambit
      wrote on last edited by
      #2

      You will have to use '\\' to represent a single '\' character in C/C++ because, anything coming after a single '\' is considered as an escape sequence in C/C++. http://msdn.microsoft.com/en-us/library/h21280bw(VS.100).aspx[^]

      1 Reply Last reply
      0
      • K kamalilam

        hi, i want to know that,how to delete a particuler file using a path in vc++ i knew that DeleteFile() ,resolve it...but i have a piece of code ..will show below..can u give me the solution .. i stored the path in Dir, Dir = "d:\testapp\abc.exe" now delete a file: deletefile(Dir);//if i take path like this then this function will delete it. //("d:\\testapp\\abc.exe") now i want to delete this file using single slash("\") inside path.. anybody know???

        J Offline
        J Offline
        Jijo Raj
        wrote on last edited by
        #3

        Hi kamalilam,

        kamalilam wrote:

        now i want to delete this file using single slash("\") inside path..

        As per C++ Character Constants[^], \ has special meaning in strings. So - "d:\\testapp\\abc.exe" is really "d:\testapp\abc.exe". Best Regards, Jijo.

        _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

        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