Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
AnswerRe: Treeview basic question Pin
dan!sh 19-Jan-09 14:37
professional dan!sh 19-Jan-09 14:37 
AnswerRe: Treeview basic question Pin
Mohammad Dayyan19-Jan-09 17:45
Mohammad Dayyan19-Jan-09 17:45 
QuestionMy dynamic table will not display... Pin
Chip Long19-Jan-09 11:30
Chip Long19-Jan-09 11:30 
AnswerRe: My dynamic table will not display... Pin
TylerBrinks19-Jan-09 13:01
TylerBrinks19-Jan-09 13:01 
GeneralRe: My dynamic table will not display... Pin
Chip Long19-Jan-09 13:13
Chip Long19-Jan-09 13:13 
AnswerRe: My dynamic table will not display... Pin
Chip Long20-Jan-09 9:51
Chip Long20-Jan-09 9:51 
QuestionLogic/Syntax for shifting all items in List<string> by +1 place</string> Pin
Abydosgater19-Jan-09 11:02
Abydosgater19-Jan-09 11:02 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
Pete O'Hanlon19-Jan-09 11:08
mvePete O'Hanlon19-Jan-09 11:08 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
DaveyM6919-Jan-09 11:24
professionalDaveyM6919-Jan-09 11:24 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
User 665819-Jan-09 11:37
User 665819-Jan-09 11:37 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
Luc Pattyn19-Jan-09 12:08
sitebuilderLuc Pattyn19-Jan-09 12:08 
AnswerRe: Logic/Syntax for shifting all items in List by +1 place Pin
Mark Churchill19-Jan-09 13:07
Mark Churchill19-Jan-09 13:07 
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 

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.