Click here to Skip to main content
15,914,419 members
Home / Discussions / C#
   

C#

 
GeneralNewbie - Unable to cast object of type... Pin
aberbotimue28-Apr-08 0:40
aberbotimue28-Apr-08 0:40 
GeneralRe: Newbie - Unable to cast object of type... Pin
Anthony Mushrow28-Apr-08 0:53
professionalAnthony Mushrow28-Apr-08 0:53 
GeneralRe: Newbie - Unable to cast object of type... Pin
aberbotimue28-Apr-08 1:16
aberbotimue28-Apr-08 1:16 
GeneralRe: Newbie - Unable to cast object of type... Pin
Anthony Mushrow28-Apr-08 2:12
professionalAnthony Mushrow28-Apr-08 2:12 
GeneralRe: Newbie - Unable to cast object of type... Pin
J4amieC28-Apr-08 0:54
J4amieC28-Apr-08 0:54 
GeneralRe: Newbie - Unable to cast object of type... Pin
aberbotimue28-Apr-08 1:14
aberbotimue28-Apr-08 1:14 
Generalcopying a large file using streaming Pin
248912828-Apr-08 0:38
248912828-Apr-08 0:38 
GeneralRe: copying a large file using streaming Pin
Anthony Mushrow28-Apr-08 1:00
professionalAnthony Mushrow28-Apr-08 1:00 
Well, you'll have to set up two streams. One to read the file, and one to write to the other.

So simply:

byte buffer = new byte[5335040]; //5MB (1024*1024)*5
FileStream read = ...;
FileStream write = ...;
int bytesRead = 0;

while(not at end of file)
{
   //I always check how many bytes where actually read, incase the desired amount isn't actualy read
   //For example: when you reach the end of the file.

   bytesRead = read.Read(buffer, 5335040);

   write.Write(buffer, bytesRead);

}


I might have the parameters on the methods a little wrong, but you get the idea right?

My current favourite word is: Bacon!
-SK Genius


General[MULTI-POST :: IGNORE IT] Re: copying a large file using streaming Pin
Vasudevan Deepak Kumar28-Apr-08 1:38
Vasudevan Deepak Kumar28-Apr-08 1:38 
GeneralBinding DataGridViewComboBoxColumn to Enumeration Pin
Bekjong28-Apr-08 0:33
Bekjong28-Apr-08 0:33 
GeneralProblem in publishing an client server application... Pin
Vicky2Galaxy28-Apr-08 0:21
Vicky2Galaxy28-Apr-08 0:21 
GeneralUnable to Capture Incoming Mail Event in Outlook Pin
narayanagvs28-Apr-08 0:09
narayanagvs28-Apr-08 0:09 
GeneralRe: Unable to Capture Incoming Mail Event in Outlook Pin
Bert delaVega29-Apr-08 5:39
Bert delaVega29-Apr-08 5:39 
QuestionCannot pass String Arrays as arguments to delegates?? Pin
ptr2void27-Apr-08 23:37
ptr2void27-Apr-08 23:37 
AnswerRe: Cannot pass String Arrays as arguments to delegates?? Pin
Vikram A Punathambekar27-Apr-08 23:44
Vikram A Punathambekar27-Apr-08 23:44 
GeneralRe: Cannot pass String Arrays as arguments to delegates?? Pin
Anthony Mushrow28-Apr-08 1:02
professionalAnthony Mushrow28-Apr-08 1:02 
GeneralRe: Cannot pass String Arrays as arguments to delegates?? Pin
ptr2void28-Apr-08 1:24
ptr2void28-Apr-08 1:24 
QuestionOpening a sub form Pin
M. J. Jaya Chitra27-Apr-08 22:49
M. J. Jaya Chitra27-Apr-08 22:49 
GeneralRe: Opening a sub form Pin
N a v a n e e t h27-Apr-08 23:08
N a v a n e e t h27-Apr-08 23:08 
GeneralRe: Opening a sub form Pin
Bert delaVega29-Apr-08 5:42
Bert delaVega29-Apr-08 5:42 
QuestionLogging by appending log entries to an XML file. Pin
Zerox MXI27-Apr-08 22:41
Zerox MXI27-Apr-08 22:41 
GeneralRe: Logging by appending log entries to an XML file. Pin
N a v a n e e t h27-Apr-08 22:58
N a v a n e e t h27-Apr-08 22:58 
GeneralRe: Logging by appending log entries to an XML file. Pin
Zerox MXI27-Apr-08 23:07
Zerox MXI27-Apr-08 23:07 
GeneralRe: Logging by appending log entries to an XML file. Pin
N a v a n e e t h27-Apr-08 23:49
N a v a n e e t h27-Apr-08 23:49 
GeneralRe: Logging by appending log entries to an XML file. Pin
Vikram A Punathambekar27-Apr-08 23:47
Vikram A Punathambekar27-Apr-08 23:47 

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.