Click here to Skip to main content
15,906,333 members
Home / Discussions / C#
   

C#

 
GeneralRe: System.OutOfMemoryException when creating big array Pin
Xmen Real 21-Apr-10 2:35
professional Xmen Real 21-Apr-10 2:35 
AnswerRe: System.OutOfMemoryException when creating big array Pin
Luc Pattyn20-Apr-10 1:21
sitebuilderLuc Pattyn20-Apr-10 1:21 
GeneralRe: System.OutOfMemoryException when creating big array Pin
Xmen Real 20-Apr-10 2:43
professional Xmen Real 20-Apr-10 2:43 
GeneralRe: System.OutOfMemoryException when creating big array Pin
Luc Pattyn20-Apr-10 3:35
sitebuilderLuc Pattyn20-Apr-10 3:35 
GeneralRe: System.OutOfMemoryException when creating big array Pin
Xmen Real 20-Apr-10 4:02
professional Xmen Real 20-Apr-10 4:02 
GeneralRe: System.OutOfMemoryException when creating big array Pin
Luc Pattyn20-Apr-10 4:24
sitebuilderLuc Pattyn20-Apr-10 4:24 
GeneralRe: System.OutOfMemoryException when creating big array Pin
Xmen Real 20-Apr-10 4:25
professional Xmen Real 20-Apr-10 4:25 
QuestionDifferent way to copy a file Pin
svanwass19-Apr-10 15:46
svanwass19-Apr-10 15:46 
In code, how can I copy a file from X:\ to X:\archive without reading entire file contents?

I am using :
FileStream fs = new FileStream("X:\\file.dat", FileMode.Open, FileAccess.Read);

                                    // Create a byte array of file stream length
                                    byte[] writeArray = new byte[fs.Length];

                                    //Read block of bytes from stream into the byte array
                                    fs.Read(writeArray, 0, System.Convert.ToInt32(fs.Length));

                                    //Close the File Stream
                                    fs.Close();

                                    // Create a synchronization object that gets 
                                    // signaled when verification is complete.
                                    ManualResetEvent manualEvent = new ManualResetEvent(false);

                                    FileStream fStream = new FileStream("X:\\archive\file.dat", FileMode.Create, FileAccess.ReadWrite, FileShare.None, 4096, true);

                                    // Check that the FileStream was opened asynchronously.
                                    Debug.Print("fStream was {0}opened asynchronously.", fStream.IsAsync ? "" : "not ");

                                    // Asynchronously write to the file.
                                    IAsyncResult asyncResult = fStream.BeginWrite
                                        (
                                        writeArray,
                                        0,
                                        writeArray.Length,
                                        new AsyncCallback(EndWriteCallback),
                                        new State(fStream, writeArray, manualEvent)
                                        );


This works, but performing
fs.Read(writeArray, 0, System.Convert.ToInt32(fs.Length));
essentially copies the file contents back to across the network
AnswerRe: Different way to copy a file Pin
Tarakeshwar Reddy19-Apr-10 16:08
professionalTarakeshwar Reddy19-Apr-10 16:08 
AnswerRe: Different way to copy a file Pin
PIEBALDconsult19-Apr-10 17:08
mvePIEBALDconsult19-Apr-10 17:08 
AnswerRe: Different way to copy a file Pin
Vikram A Punathambekar19-Apr-10 18:39
Vikram A Punathambekar19-Apr-10 18:39 
NewsOpen source Obfuscator for .Net Pin
Oguz Bastemur19-Apr-10 13:47
Oguz Bastemur19-Apr-10 13:47 
GeneralRe: Open source Obfuscator for .Net Pin
PIEBALDconsult19-Apr-10 13:52
mvePIEBALDconsult19-Apr-10 13:52 
GeneralRe: Open source Obfuscator for .Net Pin
DaveyM6919-Apr-10 14:13
professionalDaveyM6919-Apr-10 14:13 
GeneralRe: Open source Obfuscator for .Net Pin
Oguz Bastemur19-Apr-10 14:53
Oguz Bastemur19-Apr-10 14:53 
GeneralRe: Open source Obfuscator for .Net Pin
Not Active19-Apr-10 15:30
mentorNot Active19-Apr-10 15:30 
GeneralRe: Open source Obfuscator for .Net Pin
PIEBALDconsult19-Apr-10 17:05
mvePIEBALDconsult19-Apr-10 17:05 
QuestionProblems With BinaryFormatter Pin
Richard Blythe19-Apr-10 10:26
Richard Blythe19-Apr-10 10:26 
AnswerRe: Problems With BinaryFormatter Pin
Super Lloyd19-Apr-10 13:20
Super Lloyd19-Apr-10 13:20 
AnswerRe: Problems With BinaryFormatter Pin
Alan Balkany21-Apr-10 4:04
Alan Balkany21-Apr-10 4:04 
QuestionIntegrating an unmanaged window into a managed C# app Pin
Keith Vitali19-Apr-10 10:15
Keith Vitali19-Apr-10 10:15 
AnswerRe: Integrating an unmanaged window into a managed C# app Pin
Super Lloyd19-Apr-10 14:21
Super Lloyd19-Apr-10 14:21 
QuestionPlaying multiple videos with AudioVideoPlayback (flickering) [modified] Pin
Caio198519-Apr-10 8:26
Caio198519-Apr-10 8:26 
QuestionModeless dialog issue Pin
aei_totten19-Apr-10 7:52
aei_totten19-Apr-10 7:52 
AnswerRe: Modeless dialog issue Pin
Luc Pattyn19-Apr-10 8:03
sitebuilderLuc Pattyn19-Apr-10 8:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.