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#
  4. delete temp files

delete temp files

Scheduled Pinned Locked Moved C#
database
10 Posts 4 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.
  • H Offline
    H Offline
    hazzem elrefai
    wrote on last edited by
    #1

    iam developing application that get binary data from the database(.doc)files and iam storing these file in local files while dealling with it and after i finish i call System.IO.File.Delete(myfile); but most of the time the file doesn't delete so if any one know granteed way to delete my temp files

    C 1 Reply Last reply
    0
    • H hazzem elrefai

      iam developing application that get binary data from the database(.doc)files and iam storing these file in local files while dealling with it and after i finish i call System.IO.File.Delete(myfile); but most of the time the file doesn't delete so if any one know granteed way to delete my temp files

      C Offline
      C Offline
      Corinna John
      wrote on last edited by
      #2

      Files cannot be deleted while they're kept open. Are you sure that you close all stream which accessed the file, before trying to delete it?

      H 1 Reply Last reply
      0
      • C Corinna John

        Files cannot be deleted while they're kept open. Are you sure that you close all stream which accessed the file, before trying to delete it?

        H Offline
        H Offline
        hazzem elrefai
        wrote on last edited by
        #3

        i do not make streams with these files these files r doc files and i have activex control on my form opens these files and when the user exits the application these files must be deleted.

        D 1 Reply Last reply
        0
        • H hazzem elrefai

          i do not make streams with these files these files r doc files and i have activex control on my form opens these files and when the user exits the application these files must be deleted.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Then your ActiveX controls MUST close the files before the app exists. There must be some way of telling the ActiveX control to close it's files. If not, you're going to have to come up with some kind of shell around your entire app that waits for your app to close, then deletes the files... RageInTheMachine9532

          H 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Then your ActiveX controls MUST close the files before the app exists. There must be some way of telling the ActiveX control to close it's files. If not, you're going to have to come up with some kind of shell around your entire app that waits for your app to close, then deletes the files... RageInTheMachine9532

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            The ActiveX control would most likely close the file handles while being disposed, so making sure the temp files are deleted after the ActiveX control is disposed would help.

            Microsoft MVP, Visual C# My Articles

            D 1 Reply Last reply
            0
            • H Heath Stewart

              The ActiveX control would most likely close the file handles while being disposed, so making sure the temp files are deleted after the ActiveX control is disposed would help.

              Microsoft MVP, Visual C# My Articles

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Heath Stewart wrote: The ActiveX control would most likely close the file handles You said it yourself! :) most likely, but not guaranteed... I say this because I've seen some crappy ActiveX controls come out of Novell that didn't clean themselves up properly. RageInTheMachine9532

              H 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Heath Stewart wrote: The ActiveX control would most likely close the file handles You said it yourself! :) most likely, but not guaranteed... I say this because I've seen some crappy ActiveX controls come out of Novell that didn't clean themselves up properly. RageInTheMachine9532

                H Offline
                H Offline
                Heath Stewart
                wrote on last edited by
                #7

                He seems to be using the Office ActiveX controls which would close the file handles. Like you said, though, there are crappy ones out there that don't. From Novell I don't doubt that!

                Microsoft MVP, Visual C# My Articles

                D 1 Reply Last reply
                0
                • H Heath Stewart

                  He seems to be using the Office ActiveX controls which would close the file handles. Like you said, though, there are crappy ones out there that don't. From Novell I don't doubt that!

                  Microsoft MVP, Visual C# My Articles

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  Heath Stewart wrote: From Novell I don't doubt that! :laugh: You sound like you speak from experience? RageInTheMachine9532

                  H 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    Heath Stewart wrote: From Novell I don't doubt that! :laugh: You sound like you speak from experience? RageInTheMachine9532

                    H Offline
                    H Offline
                    Heath Stewart
                    wrote on last edited by
                    #9

                    With their networking protocols and the like, yes. I just don't like them and with Active Directory and *nix-based networks dominating the market, I can't believe Novell is still around. I guess they think that clinging to open-source will save them. Nothing like jumping on the bandwagon...until it falls off a cliff! Bwahahahaha!

                    Microsoft MVP, Visual C# My Articles

                    D 1 Reply Last reply
                    0
                    • H Heath Stewart

                      With their networking protocols and the like, yes. I just don't like them and with Active Directory and *nix-based networks dominating the market, I can't believe Novell is still around. I guess they think that clinging to open-source will save them. Nothing like jumping on the bandwagon...until it falls off a cliff! Bwahahahaha!

                      Microsoft MVP, Visual C# My Articles

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #10

                      On top of all that, it still needs a DOS partition to boot and still relies on 16-bit code in it's kernel. Won't be fixed until NetWare 8 with a complete rewrite of the kernel, if the company survives that long... RageInTheMachine9532

                      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