Close a stream for System.IO.Copy

Hello
I have this code. I want close this stream, because I have this Error in another place of my program.
ERROR: word cannot save this file because it is already open elsewhere
string sourceFile = richTextBox_I.Text;
string destFile = Application.StartupPath + @"\UserImages\" + name;
System.IO.File.Copy(sourceFile, destFile, true);

I used the following code. Now I do not have any problem:
string pathSource = richTextBox_I.Text;
string pathNew = Application.StartupPath + @"\UserImages\" + name;
try
using (FileStream fsSource = new FileStream(pathSource,
FileMode.Open, FileAccess.Read))
// Read the source file into a byte array.
byte[] bytes = new byte[fsSource.Length];
int numBytesToRead = (int)fsSource.Length;
int numBytesRead = 0;
while (numBytesToRead > 0)
// Read may return anything from 0 to numBytesToRead.
int n = fsSource.Read(bytes, numBytesRead, numBytesToRead);
// Break when the end of the file is reached.
if (n == 0)
break;
numBytesRead += n;
numBytesToRead -= n;
numBytesToRead = bytes.Length;
// Write the byte array to the other FileStream.
using (FileStream fsNew = new FileStream(pathNew,
FileMode.OpenOrCreate, FileAccess.Write))
fsNew.Write(bytes, 0, numBytesToRead);
catch (FileNotFoundException ioEx)
MessageBox.Show(ioEx.Message);

Similar Messages

  • Exec() - G77 Fortran blocks read(*,*)  until Java closes output stream.

    This is my first post!
    I have a program in fortran using G77 from GNU. When I start the program and write to the output stream I have to close() the stream for the message to arrive at the other end. G77 seems to need Java to close the stream for the message to be sent.
    Then, the stream is forever closed and can not be re-obtained for subsequent writes.
    I do not need to close() with microsoft fortran. It works fine with a simple flush().
    My code for Microsoft is below, followed by same code for G77:
    Any ideas?
    Disciple285
    // write to stream with Microsoft Fortran
    std_out.println(message);
    std_out.flush();
    // write to stream with G77 Fortran
    std_out.println(message);
    std_out.close();

    Hi:
    The internal OJVM is not affected by your installations of any other Sun JDK on the server.
    So you can not upgrade your internal OJVM without upgrading the entire DB.
    Oracle 10g includes a JDK 1.4 runtime, 11g a 1.5 runtime and so on.
    If you can upgrade your Oracle 9.2.0.8 to a 10g release you can then compile the code, if not you should re-write the code to compile with an standard JDK 1.3 release.
    Best regards, Marcelo.

  • Transport for System Copy from RSA1 in BW 3.5

    Hi Guys,
    I am not able to create transport for Source system objects for system copy in RSA1.
    I have copied the production system(BWP) to sandbox(BWQ) and want to connect to same source system.
    According to note 886102 when creating transport for Source system objects I am getting following error.
    You cannot use request BWQK900020
    Object ISIP ZPAK_5FKMUFOSQPPRNYYDZV1U6A7W0 could not be saved to order
    BWQK900020
    This is stand alone system but for transports I have created virtual system. Before creating virtual system I am able to create transports. But now after creating virtual systems I am not able to get pass above errors.
    Any help would be appreciated also with points.
    regards,
    Santosh

    Hi,
    Check the notes 140276 and 325470 to chart out a plan of action.
    BR/
    Mathew.

  • What number should I put in "Number of Qualifying system for right to copy" in OS mountain lion up-to-date program form?

    what number should I put in "Number of Qualifying system for right to copy" in OS mountain lion up-to-date program form? I'm a newbie on mac, just bought MBA two weeks ago. I've tried software update but it is not upgraded to mountain lion. what should I do to upgrade for free?

    I'm on the page "https://uptodate.apple.com/UtdPrepareAction?program=Mountain%20Lion&locale=en_au"
    and I still have the same question as the original poster, what number should I enter into the field:
    "Number of qualifying systems".. cause "1" doesn't do it.. and the other numbers don't work... >:___:<

  • Save for system Copy grouping how we can use

    Hi,
    In transporting objects for grouping the collected objects (necesaary,iefore,after and befroe ,after i am ok with those) i do not know waht is the use save for system Copy can anybody expalin what it is and how it is useful when collecting the objects.
    Thanks & Regards
    sathish

    Hi,
    Before transport the objects, you must set the source system connections, we won't trasport source systems, but I need to tell to my system if I release and Transport the request then where it shoud go and which source system/target system like this , you can check in RSA1>Tools>Assignements of source system.
    I'm not getting
    what is the difference between for coping and before after collecting please i want some clarification
    Thanks
    Reddy

  • Error while running sapinst for system copy

    Hi all,
    For system copy activity of our ECC 6 system, we ran sapinst to take data export but it is not getting started and giving error "Login in process error -
    An attempt to write to socket 1684 failed; reason: This application has requested the runtime to terminate it in an unusual way."
    Any idea how to fix this !!!!!!
    Thanks & Regards,
    Pavan I

    Hi,
    Here is my opinion on this error, please try this out if you have downtime on your ECC system.
    1. Reboot your windows system and then try exporting your DB.
    2. Alternatively bring down your SAP system and DB and then try running the export and see whether it is moving fine.
    Keep us posted with your feedback which will help to provide you with any other additional troubleshooting points.
    Best Regards,
    Vasanth G

  • System Content Copy Guide For 2004s

    Hi,
    Can any one help me out how to perform System Content Copy for netweaver 2004s From Oracle 10.2 database ,windows 2003 servers to MaxDB 7.0,windows 2003 sever.
    Thanks
    Venu

    this is not a system copy, this is migration
    follow https://websmp102.sap-ag.de/osdbmigration
    Cheers,
    -Sunil

  • Where do I find the "Number of Qualifying Systems for Right To Copy? I qualified for a free upgrade of montain lion.

    I was filling the form to get a free upgrade for the mountain lion. I qualified for that because I bought it in the time stipulated. When they asked me about the number of qualifying systems for right to copy I don't know what to write.

    That's for organizations with group licenses. If you are applying as an individual, you can ignore that field.

  • Multiple Hard Drives: one for system & applications, one for backup

    I am planning the upgrade of my hard drive setup. Presently, I have only the original 74.53 GB internal drive that came with my June 2004 G5 1.8 dual CPU. I have two goals for the upgrade. First, more hard drive space. Second, a drive for automatic backup. Since I am running OS 10.4.11 and not intending to upgrade to 10.5 at this time for application reasons, I will be using something like Carbon Copy Clone for the backup software (not Time Machine, which requires OS 10.5). My thinking, so far, is to install a 1 TB internal drive for system and another internal or external 1 TB drive for the backup. In perusing the discussions here, it looks like an external drive is always used for the backup. Is this true or would an internal drive work just as well for backup? I want the backup to be as free as possible from any corruption or problems that might arise on the system drive or other computer parts. Does the Firewire or USB connection of an external drive offer a greater amount of freedom from potential corruption as opposed to the direct SATA connection of an internal drive?
    I realize that burnt DVD’s offer the greatest amount of freedom from corruption but one doesn’t burn a DVD hourly, daily, weekly or so on. Hopefully, if a problem arises my work underway is residing on the backup drive unaffected. I’m not sure how close in time this can be. I imagine this probably depends on the backup software used and how often the backup is run. I’m not yet fully aware of the options.
    For the internal system drive is there any good reason to partition it? I f so, why, and in what way? Do the OS and applications need to reside on the same partition? If not (or better that they don’t), how should a 1 TB drive be partitioned?
    Thanks in advance for any suggestions on the best configuration of my hard drive upgrade.

    1) The backup drive is best to be external (security from computer failure).
    Yes. I am not sure about the "in some ways" my esteemed colleague qualifies.
    2) The external backup drive should be connected by Firewire (ability to be bootable & greater speed).
    Yes. Just beware that some of the Western Digital models have presented problems. Not the drives themselves but the enclosures. [List of Western Digital bootable and non bootable models|http://discussions.apple.com/message.jspa?messageID=9022456#9022456]
    Is a Firewire connected drive any less vulnerable to damage by computer hardware failure than an internal drive?
    Yes & no. The yes: I don't know about G5s (they use a different connector from the G4s and earlier with which I am familiar) but in some computers the drives will share the same controller. If the controller goes then all connected drives can be corrupted. The no: Then too, I have had two Firewire drives be corrupted. One was by trying it with a PCI card (not what you're using) that was incompatible with my model computer. The other was when the power source in the enclosure went bad.
    This is almost leading me to think that 3 drives would be the best! One internal for OS system & applications (1 TB), one continually connected for auto backup (my original 74 GB), and one (a bootable clone) attached only during occasional backups (2 TB).
    The more the better. I usually buy drives in size increments that make sense for my configuration. I have two 120GB internal drives so I bought a 250GB external drive for backup and partitioned it into two so I could just back up one internal to one partition and the second to the other.
    I'm perplexed with both your feelings about burnt media. I was not aware of this and fortunately have not experienced problems. However, it is only recently that I gravitated from 700MB CD's to 4.7 GB DVD-RW's for backups. I've been using Maxell
    There's backup and there's archiving. Backup is for having a copy of what you're actively using. Archiving is storing stuff that is unlikely to change. Optical media is lousy for backup because files are constantly changing. Backing up a 120 GB onto 4GB media either requires a super organized person or you're spending a day sticking DVDs into your computer.
    Optical media is less lousy for archiving, but still not great. Where's the floppy drive on your computer? Where will the DVD drive be in 15 years? It's also a lot faster archiving onto hard drives, and the cost of drives has come down to where the per GB cost is about equivalent of less than high-quality, archival-grade DVDs. Yes, drives change too, but it is also easy to copy from drive to drive. I have items archived on drives that are over 10 years old and as long as I make sure I keep on top of being able to connect those drives to a computer they are usable.
    BTW: I tried to quote your messages for this reply, went to "Help" to learn how that is done and found this: "If you want to quote specific text from the original message, click Quote Original to add all the text from the original message to the Message box." I could see no such button "Quote Original". Can anyone please tell me where it is?
    There's a '"' icon in the compose window when you type a reply. If I'm doing a lot of quotes (as I did here) I use that, then edit out the bits I don't want. Otherwise I copy and paste the text and add a > before the line to get it to appear in the special format.

  • Move file or mark for system move file - How?

    Hello,
    I finally bought Lightroom. Searching these posts I saw someone commenting about why a person would want to use LR to move a file. Seriously? Because I Want it to be a full on DAM solution. And the first mess I must de-tangle involves some years of very bad habits, both in iphoto and in my own head.
    Therefore, there is something that I don't think Lightroom can do yet but I would love to be found wrong. I don't think LR is much help in marking for the system to find later out side of LR, and then moving the files, right, wrong?
    I don't care if it marks the file in a way that the system can later find it and move it, or, if LR moves a selected file set already in LR. Either way what I am trying to do is organize correctly and that must mean moving found sets of files to where they belong.
    It seems like overkill to purchase iView just for this one task. Qpict is a lot cheaper than iView ($35 vs $199) and can move files around. I was just wondering though why LR cant yet do this? OR, am I wrong? Does anyone but me think this is important? Any others requesting this (LR is missing applescript support on the Mac side as well)
    Thanks
    David

    levelbest,
    If I understand your question, you've got many images in iPhoto that you want to reorganize and import into Lr. Is that the issue?
    If so, there are various ways to tackle it. One easy way is to create the new folders as you go.
    On your Desktop, make a new folder (Shift-Cmd-N). Name it "For Lr Import."
    Now open iPhoto. Scroll back to your first image in iPhoto. Let's say it's from the year 2000. Select that first image plus the photos you want to group with it. Maybe they are all shots of Niagara Falls. Export only those photos (full-size) to that Desktop folder you just made: "For Lr Import."
    Now switch to Lightroom. Go to File: Import Photos (or Shift-Cmd-I). In the window that opens, navigate to Desktop>For Lr Import. Select all the photos in that folder (click on the the first and then Cmd-A), and click Choose.
    That window will close and the Lr Import dialog will open. Your choices here will depend on what kind of files you're working with - jpeg or raw, and what you want to do with them. The options are easy to figure out. This method works faster if you choose a "move" option rather than a "copy" option because it will move the images out of the desktop folder and into whatever folder you create for them. "Copy" leaves them sitting in that Desktop folder, and you've gotta clear 'em out manually before the next export/import -- an extra step each time.
    So here's one way to go (in the Lr Import dialog):
    Under File Handling, select "Move Photos to a new location and import."
    Under Move To, navigate to Pictures. Create a new folder. Name it Photos 2000. Inside that folder, create another new folder. Name it Niagara Falls.
    Under Organize, select By Date and pick a date format.
    Don't miss taking advantage of the backup option. Check the "Backup To" box and create a similar hierarchy on a different drive. You could call the top-level folder Photo Originals.
    Now you've created a hierarchy you can continue using with each export from iPhoto. Just keep adding folders to Photos 2000 until you exhaust that year. Then create Photos 2001 the same way. All your photos will eventually be organized by year>topic>date (or however you set up the hierarchy).
    If you are converting raw to dng during import, the process is the same. You can use the backup function to preserve your raw files.
    Good luck,
    Jack

  • When I open iTunes, I receive an error that reads "iTunes has encountered a problem and needs to close.  Sorry for the convenience."  When I click to see the error, it reads "AppName: itunes.exe      AppVer: 10.5.2.11      ModName: msvcr80.dll"  Why ?

      When I open iTunes, I receive an error that reads "iTunes has encountered a problem and needs to close.  Sorry for the convenience."  When I click to see the error, it reads "AppName: itunes.exe  AppVer: 10.5.2.11  ModName: msvcr80.dll"  Why ?  I am overly frustrated.  Please help.  Not exactly sure which operating system I have.  It is a dell laptop with xp.
    AppName: itunes.exe AppVer: 10.5.2.11 ModName: msvcr80.dll
    ModVer: 8.0.50727.6195 Offset: 00026b72
       AppName: itunes.exe AppVer: 10.5.2.11 ModName: msvcr80.dll
    ModVer: 8.0.50727.6195 Offset: 00026b72

    Well I was able to successfully revert back to iTunes8. Here's my steps:
    1. In Add/Remove Programs I deleted all Apple products (iTunes, QuickTime, Safari, Bonjour, etc.)
    2. I then check C:\Program Files\ and made sure all folders were deleted (QuickTime, etc.)
    3. I then ran a Registry Cleaner program to make sure all entries from Apple products were removed.
    4. I then rebooted my PC
    5. I then downloaded iTunes8.0.2 from here: http://www.apple.com/downloads/macosx/apple/ipod_itunes/itunes802forwindows.html
    6. After it installed it said it could use my iTunes library file because it was created with a newer version. So I re-created my library by following these steps: http://support.apple.com/kb/HT1451
    It took some time but iTunes is now back up and running. And I have all my playlists, etc. I haven't tried to sync anything yet. I'm just thrilled to have my iTunes back!

  • [Feature Request] Seperate tab in log window for System.err

    By default, the stack traces of exceptions (and throwables in general) are printed to the System.err stream. So, wouldn't it be useful to include a 2nd tab for System.err messages?
    It could be optional to either include or leave out the System.err output in the System.out tab.
    The whole idea of this 2nd tab is to set it up like the search output tab: a tree-like list which can be expanded to see the stack trace of each exception that occured during runtime. A small parser can parse the stack trace when an exception is printed on the System.err stream and format it.
    If this option would be availble in the debugger only, that would be ok too, I guess. Although, the debugger already has some other means of jumping through code when an exception is thrown (ie, when the debugger 'pauses' runtime).

    I've logged an Enhancement request to improve the handling of System.err messages (2811508). There are ways to enhance the treatment of System.err messages without introducing a new tab, through the use of color, links back to the source code, and collapsing of entire stack traces to a single line (with a button to see the entire trace).
    Thanks!
    -- Brian

  • There is no iView available for system "SAP_ERP_Manufacturing"...

    Hi out there,
    I have imported the business packages Common Parts 1.2 and Maintenance Technician 1.2 in our portal testsystem (nw7, sps18). after setting up a system with alias SAP_ECC_MANUFACTURING and asigning the role com.sap.pct.erp.maintech.maintenance_technician to my super admin user I can browse through the navigation of this role and all the iviews do what they are supposed to to (e.g. I can call the "Technical Structure View" and create a notification for an object out of the list)...
    When assigning the role com.sap.pct.erp.maintech.maintenance_technician to a test user (with the roles and groups from a simple enduser), I get the following error when trying to create anotification (or doing anything else in the technical structure view): There is no iView available for system "SAP_ERP_Manufacturing": object "notification".
    I have checked the permissions in all relevant areas of the PCD. Everywhere there are at least read permissions for everyone. Also I have copied the iView com.sap.pct.erp.common.notification_create to another place in the PCD and added it to the operation "create" of the Business Object "SAP_ERP_Manufacturing.notification" (with the highest priority). But that didn't change anything...
    Well, I don't know what else I could do to find out what's wrong. I just hope anyone out there can help me out... )
    Best Regards
    Juergen Kuechle.

    Hi Thulasi,
    sorry, but that's not the point. The system with alias "SAP_ECC_MANUFACTURING" is used to call the WD application in the R/3 backend system (which works out pretty fine). The WD application then calls back the portal using the object based navigation technology (OBN). In this case it calls the object SAP_ERP_Manufacturing.notification and tries to execute the iview linked to the action "create" of the object.
    And here exactly is the problem that I'm facing. With the super admin user OBN works fine, with an enduser the OBN fails...
    Regards, Juergen.

  • I give up! - waiting for items to copy

    I know a lot has been said on the subject and I've said a few things myself.  However, I've about reached my breaking point and would love it if someone could point me the way to someone at Apple to talk to.
    I'm referring to syncing and the dreaded message generally at the end of the sync, "waiting for items to copy."  Sometimes the message will end after a long time (an hour) and all will seemingly be ok, and sometimes it will continue indefinitely.  I've tried virtually every suggestion here and from apple senior support.  I have had the same problem for well over a year with 2 iPads and 2 iPhones.  I've had syncing problems seemingly forever, back to 3 years ago when I had a MacBook Pro and after with my present computer, an iMac.  However, the problem was not the same previously, i.e., waiting for items to sync., in the past year or so.   It seems to be happening with more regularity now, like almost every time I want to completely change songs on my devices.
    If I interrupt the "waiting for items to copy," I often get a huge amount of "other" indicated in the bar graph in iTunes showing the amount of audio, apps, etc.
    I have a large library, almost 2TB and 80k songs.  I don't know if that's the problem.  I also have a 124gb iPad and 2 64gb iPhones.  I rotate the songs every few weeks... I have about 15 playlists set up randomly so I can just switch playlists.  As a result, I can rule out that corrupt songs are causing the problem unless there are a lot of corrupt songs.
    Without exaggeration, I must have talked to 10 senior apple technicians.  I'm covered by Apple Care on all but one of my 3 devices.  It's always a very lengthy conversation and doing mostly the same things over and over with call backs necessary.  And the problem doesn't get resolved.
    The only way I can seem to resolve the issue is by doing a complete erase on the device and syncing my songs 1 playlist at a time.  It's an incredibly lengthy process, especially when I try to sync normally at first and that fails - there went up to a few hours' time.
    However, I'm not so sure about this method any longer.  I sync'd my iPad yesterday, which took an entire day or about 15 hours.  After completely erasing everything and restoring, I sync'd 1 playlist at a time as previously mentioned.  I got the "waiting" message after each sync, but it eventually went away and all seemed fine.  That is, until I checked my iPad.  I should have had 22,000 songs (according to iTunes and a manual count of songs taking the totals from my playlists) but the iPad indicated only 12,000.
    If it is not an inherent problem with every version of iTunes and/or every OS in the last few years, the only other thing I can think of is that's my computer.  I am flinging my hands up in the air at this point and begging for a phone number of someone to talk to who can help.  Most of the senior iTunes reps claim they are unaware of the problem, which is baffling to me.

    (In response to Mike Stitzer's post):
    I'm a 30-year+ PC user (DOS then Windows) with a systems programming and admin background in Unix.  Apple is still a bit foreign to me, although not out of the realm of understanding.  The problems Apple now faces deal with (1) its popularity, which now makes it susceptible to the same kind of hacking-attacks that Windows has endured forever (which has nothing to do with these problems, granted); (2) complexity of the technology and (3) inexperience and/or lack of knowledge plus limited training of its customer & tech support staff (both of these being the central issues of this syncing problem). 
    You make a good point: these companies are now using "us" as their beta-testers. They don't thoroughly vet their products before releasing them into the market, and then leave it up to the users to find problems/bugs, and maybe even figure out how to fix them.  I don't know, honestly, but that's how it seems.  Maybe they don't care.  Maybe they know their client-base will remain steady and reliable because people still want to have iPads and iPhones and iPods.  And like all tech companies, Apple is always moving on to the next best thing, the newest upgrade features which lure their client-base to buy again, and attract new buyers.  Like any other company, their bottom line is what matters, and fixing problems, such as this sync one, may not be cost-effective enough to rise to the level of fixing, simply because it doesn't appear to be widespread enough, although who knows.  I know people who have iphones who NEVER connect them to their laptops for syncing, who buy music from iTunes from their iPhone and that's their music library.  That's the extent of their 'use.'  There are a lot of Apple customers, maybe a majority of users, who have no clue about ninety-percent of what is discussed in these forums. 
    In any event, for some reason, after I updated to the latest iTunes, I was able to sync my three "i" devices, iPhone--which was what I was having the trouble with; then the iPad and just the other day, my iPod Classic; all synced without problem.  Last Sunday I did, momentarily, have the "waiting to apply changes" stick while trying to sync some newly made ring tones to my iPhone, so I bailed out of the process, rebooted my (Windows 7) laptop, and tried again, and it took.  Don't ask me why.  I have no idea. 
    Regarding Windows... I have to say that since Microsoft's XP, I haven't had many problems with the system.  I had seriously considered getting a Mac the next time I get a new laptop, and just going "all Apple" but I'm definitely reconsidering that now.  With all the new products coming on the market now, I don't want to put all my cookies into one jar... you know?  Things change, that's a guarantee. 

  • I want to put windows 7 on my iMac. Do I use Windows 7, 64 bit System Builder or do I use a "retail copy" of the Windows 7, 64 bit ? Microsoft says I should use the System Builder copy. A technical support individual from Apple said use the "retail copy"

    A Microsoft technical advisor said that the "retail copy" of Windows 7, 64 bit Home Premium would not work with Boot Camp to put the Windows operating system on the IMac. She said that I would have to use the System Builder copy of Windows 7 to put it on my iMac. An Apple technical advisor told me that I had to use the "retail copy" of Window 7 because that was the one used by Apple when they developed the Boot Camp program.  I have also seen some articles from Apple that suggests that both copies of Windows 7 would work OK. Does anyone have any experience that shows which one or both I should purchase to put on my computer?

    Welcome to ASC!
    I used the 64-bit System Builder Edition when I bootcamped my 2010 iMac a couple of years ago. Worked perfectly--installed a very lean system. Without all the extra cr@pware that comes preinstalled on name-brand Win computers, the SBE OS actually works darned well.
    However, that was under Mac OS 10.6.8 which remains on that computer for compatibilty reasons not related to Windows. Haven't BCed any newer Mac OS, so your mileage may vary.

Maybe you are looking for

  • A fatal error has occured while updating your device's software

    I have a problem I hope you guys can help me. Blackberry Model: 8820 Device Software version: 4.5.0.55 Desktop Software version: 4.7.0.37 Carrier: Singapore Telecom Mobile Pte Ltd(https://www.blackberry.com/Downloads/browseSoftware.do) Everytime I st

  • Fault while calling a Web service using SOAP 1.2

    Hi , I have created a simple PL/SQL web service using Jdeveloper from PL/SQL using SOAP 1.2. But while i call that from PL/SQL, i am getting a version mismatch. While the same service created from SOAP 1.1 is working fine. Can anyone Help???

  • Regarding overall purchase requisition release strategy

    Hi,       For following combination PR release strategy  is not working. 1.Total value of requisition 2.Purchasing Organization 3.Name of Requisitioner/Requeste But when we take any one of them it is working. But when I tried to put together, these f

  • Can't delete photos using Image Capture

    I just upgraded from an iPhone4 to 5s....all of a sudden I can't delete photos using Image Capture like I used to.  The "delete" menu item is grayed out.  The "delete after import" checkbox in the lower right is available, but I don't need to downloa

  • Gray screen of death on boot-up

    I have a 2.1 GHz MacBook with a 120GB hard-drive that I bought last November. I've been doing a lot with video and music and I keep running out of disk space. So, I keep deleting files that I thought I didn't need. Unfortunately, I must have deleted