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

process problem

Scheduled Pinned Locked Moved C#
helpcsharpquestion
2 Posts 2 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.
  • E Offline
    E Offline
    E_Gold
    wrote on last edited by
    #1

    hi after i unzip file and try to copy him, i get error process is used by another program what can be the problem ? (work on WinForm - C#)

    ZipInputStream sampleInputStream = new ZipInputStream(File.OpenRead(UnZIP_ZipFile));
    ZipEntry sampleFile = null;
    string sampleOutputDirectoy = UnZIP_RegFile;
    int sampleSize = 2048;
    sampleInputStream.Password = "12345";
    while ((sampleFile = sampleInputStream.GetNextEntry()) != null)
    {
    sampleSize = 2048;
    if (Path.GetFileName(sampleFile.Name) != string.Empty)
    {
    string sampleFilePath = sampleOutputDirectoy + @"\" + sampleFile.Name;
    FileStream sampleFileStream = File.Create(sampleFilePath);
    byte[] sampleFileData = new byte[sampleSize];
    while (true)
    {
    sampleSize = sampleInputStream.Read(sampleFileData, 0, sampleFileData.Length);
    if (sampleSize > 0)
    sampleFileStream.Write(sampleFileData, 0, sampleSize);
    else
    break;
    }
    sampleFileStream.Close();
    sampleFileStream.Dispose();
    }

            }
            sampleInputStream.Close();
            sampleInputStream.Dispose();
            MessageBox.Show(" ");
    
    L 1 Reply Last reply
    0
    • E E_Gold

      hi after i unzip file and try to copy him, i get error process is used by another program what can be the problem ? (work on WinForm - C#)

      ZipInputStream sampleInputStream = new ZipInputStream(File.OpenRead(UnZIP_ZipFile));
      ZipEntry sampleFile = null;
      string sampleOutputDirectoy = UnZIP_RegFile;
      int sampleSize = 2048;
      sampleInputStream.Password = "12345";
      while ((sampleFile = sampleInputStream.GetNextEntry()) != null)
      {
      sampleSize = 2048;
      if (Path.GetFileName(sampleFile.Name) != string.Empty)
      {
      string sampleFilePath = sampleOutputDirectoy + @"\" + sampleFile.Name;
      FileStream sampleFileStream = File.Create(sampleFilePath);
      byte[] sampleFileData = new byte[sampleSize];
      while (true)
      {
      sampleSize = sampleInputStream.Read(sampleFileData, 0, sampleFileData.Length);
      if (sampleSize > 0)
      sampleFileStream.Write(sampleFileData, 0, sampleSize);
      else
      break;
      }
      sampleFileStream.Close();
      sampleFileStream.Dispose();
      }

              }
              sampleInputStream.Close();
              sampleInputStream.Dispose();
              MessageBox.Show(" ");
      
      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      There is a problem in the first line. I leave it up to you to find and fix it. BTW: "File in use by another program/process" isn't the best Windows message, it may well be (most often is) the same process causing the situation. :)

      Luc Pattyn


      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


      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