Click here to Skip to main content
15,885,309 members
Home / Discussions / C#
   

C#

 
QuestionThreads / Class / Array Pin
Planker19-Jan-09 9:51
Planker19-Jan-09 9:51 
AnswerRe: Threads / Class / Array Pin
SeMartens19-Jan-09 21:27
SeMartens19-Jan-09 21:27 
QuestionHow create professional docu? Pin
Frygreen19-Jan-09 8:49
Frygreen19-Jan-09 8:49 
AnswerRe: How create professional docu? Pin
Eddy Vluggen19-Jan-09 9:07
professionalEddy Vluggen19-Jan-09 9:07 
AnswerRe: How create professional docu? Pin
Colin Angus Mackay19-Jan-09 10:27
Colin Angus Mackay19-Jan-09 10:27 
AnswerRe: How create professional docu? Pin
Not Active19-Jan-09 10:33
mentorNot Active19-Jan-09 10:33 
AnswerRe: How create professional docu? Pin
Frygreen20-Jan-09 8:05
Frygreen20-Jan-09 8:05 
Questionread byte[] from file, save byte[] in new file, different size Pin
arturw8219-Jan-09 8:22
arturw8219-Jan-09 8:22 
Function read bytes from file and save in new file, but after this operation size of the new file is different

source file: Size 26,6 KB (B: 27300)
after
Size: 26,8KB (B: 27468)

bufferSize= 252
enter= 27300
enter / bufferSize = 108,(3) so 109 blocks
109* bufferSize = 27468

How can I do this correct?
Please for Your help

C# code

private void button1_Click(object sender, EventArgs e)
{
readMyStream("D:\\files\\myFile.txt");
}
Stream inputStream;
Stream outStream;

int bufferSize = 252;
byte[] buffer;
private void readMyStream(string fileName)
{

buffer = new byte[bufferSize];

inputStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, true);
outStream = new FileStream("D:\\plikiTxt\\az.txt", FileMode.Create, FileAccess.Write, FileShare.Write, bufferSize, false);

inputStream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnCompletedRead), null);
}

private void OnCompletedRead(IAsyncResult asyncResult)
{

int bytesRead = inputStream.EndRead(asyncResult);

if (bytesRead > 0)
{

outStream.Write(buffer, 0, buffer.Length);
inputStream.BeginRead(buffer, 0, buffer.Length, new AsyncCallback(OnCompletedRead), null);
}
else
{

inputStream.Close();
outStream.Close();
}
}
AnswerRe: read byte[] from file, save byte[] in new file, different size Pin
Jimmanuel19-Jan-09 9:46
Jimmanuel19-Jan-09 9:46 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
arturw8219-Jan-09 10:01
arturw8219-Jan-09 10:01 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
Jimmanuel19-Jan-09 10:25
Jimmanuel19-Jan-09 10:25 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
arturw8220-Jan-09 6:23
arturw8220-Jan-09 6:23 
GeneralRe: read byte[] from file, save byte[] in new file, different size Pin
Jimmanuel20-Jan-09 7:12
Jimmanuel20-Jan-09 7:12 
QuestionProgramming Web In C# Pin
trinm198719-Jan-09 7:45
trinm198719-Jan-09 7:45 
AnswerRe: Programming Web In C# Pin
EliottA19-Jan-09 9:28
EliottA19-Jan-09 9:28 
AnswerCP IGNORE USER...THIRD time he's posted this. Pin
leckey19-Jan-09 10:20
leckey19-Jan-09 10:20 
QuestionPrint Start event Pin
spiritboy19-Jan-09 7:30
spiritboy19-Jan-09 7:30 
QuestionDeveloping a small DBMS software tool Pin
Calma19-Jan-09 7:27
Calma19-Jan-09 7:27 
AnswerRe: Developing a small DBMS software tool Pin
spiritboy19-Jan-09 7:39
spiritboy19-Jan-09 7:39 
GeneralRe: Developing a small DBMS software tool Pin
spiritboy19-Jan-09 7:46
spiritboy19-Jan-09 7:46 
AnswerRe: Developing a small DBMS software tool Pin
Wendelius19-Jan-09 8:34
mentorWendelius19-Jan-09 8:34 
QuestionArray of account data Pin
ferronrsmith19-Jan-09 7:01
ferronrsmith19-Jan-09 7:01 
AnswerRe: Array of account data Pin
Not Active19-Jan-09 7:03
mentorNot Active19-Jan-09 7:03 
GeneralRe: Array of account data Pin
ferronrsmith19-Jan-09 7:11
ferronrsmith19-Jan-09 7:11 
GeneralRe: Array of account data Pin
Not Active19-Jan-09 7:37
mentorNot Active19-Jan-09 7:37 

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.