Click here to Skip to main content
15,911,525 members
Home / Discussions / C#
   

C#

 
GeneralRe: MaskedTextBox help Pin
Hristo-Bojilov16-Aug-09 2:00
Hristo-Bojilov16-Aug-09 2:00 
QuestionAnnotations on screen Pin
Vijay Mudunuri15-Aug-09 22:54
Vijay Mudunuri15-Aug-09 22:54 
Questionstatic data members and methods Pin
Black Gen15-Aug-09 21:28
Black Gen15-Aug-09 21:28 
AnswerRe: static data members and methods Pin
OriginalGriff15-Aug-09 22:03
mveOriginalGriff15-Aug-09 22:03 
AnswerRe: static data members and methods Pin
Saksida Bojan15-Aug-09 22:09
Saksida Bojan15-Aug-09 22:09 
Questionadding PNG icons with tranparency to listview Pin
Muhammad Ahmed15-Aug-09 16:22
Muhammad Ahmed15-Aug-09 16:22 
AnswerRe: adding PNG icons with tranparency to listview Pin
Henry Minute16-Aug-09 3:19
Henry Minute16-Aug-09 3:19 
QuestionFileStream runtime issues (Updated) [modified] Pin
Mikey_H15-Aug-09 14:21
Mikey_H15-Aug-09 14:21 
I am having some issues using a Filestream to read a text file. The file contains repeated segments of text in the format shown below. when I attempt to read it, it will not read the entire file, it will stop at the line shown (this line is at a variable position, there can be any number of lines before it). However... if I open the text file from windows explorer and save it (not altering the text), it has no problem reading the entire file the next time the program runs.

Anyone have any ideas, or have run into this problem before?

UPDATE: After doing some more testing, I've found that FileStream IS reading to the buffer, as I can write the contents of the buffer to a new text document, and the entire file is copied. The error appears to be occuring somewhere else. I have also tried the StreamReader class and it has the same issue.

FileInfo   m_fileInfo   = new FileInfo("C:\\Programs\\PartyGaming\\PartyPoker\\HandHistory\\xxxxxxxxxx\\xxxxxxxxxx\\Speed #xxxxxxx_xxxxxxx.txt");
long       length       = m_FileInfo.Length;
byte[]     buffer       = new byte[length];

using (FileStream stream = new FileStream(m_FileInfo.FullName, FileMode.Open, FileAccess.Read))
{
     // Read data from file to the buffer
     for (long i = 0; i != length; i++)
          buffer[i] = (byte)stream.ReadByte();
}


After reading to byte array I am converting to a string for further process by a StreamReader object

string data = new System.Text.UTF8Encoding(true).GetString(buffer);

MessageBox.Show(data); // Shows incomplete file


The file.....

Game #xxxxxxxxxx starts.

#Game No : xxxxxxxxxx 
***** Hand History for Game xxxxxxxxxx *****
$10 USD NL Texas Hold em - Wednesday, July xx, xxxxx EDT 2009
Table Speed #xxxxxxx (Real Money)
Seat 4 is the button
Total number of players : 9 
Seat 7: xxxxx ( $9.11 USD )
Seat 1: xxxxx ( $11.32 USD )
Seat 6: xxxxx ( $10 USD )
Seat 8: xxxxx ( $2 USD )
Seat 9: xxxxx ( $12.33 USD )
Seat 4: xxxxx ( $14.93 USD )
Seat 2: xxxxx ( $2.63 USD )
Seat 5: xxxxx ( $14.96 USD )
Seat 3: xxxxx ( $18.61 USD )
xxxxx posts small blind [$0.05 USD].
xxxxx posts big blind [$0.10 USD].
** Dealing down cards **
Dealt to xxxxx [  Qs 2h ]
xxxxx calls [$0.10 USD]
xxxxx calls [$0.10 USD]
xxxxx raises [$0.20 USD]
xxxxx folds
xxxxx folds
xxxxx folds
xxxxx calls [$0.15 USD]
xxxxx calls [$0.10 USD]
xxxxx calls [$0.10 USD]
xxxxx calls [$0.10 USD]
** Dealing Flop ** [ 4s, 6d, 9s ]
xxxxx checks
xxxxx checks
xxxxx bets [$0.71 USD]
xxxxx folds
xxxxx raises [$1.42 USD]
xxxxx folds
xxxxx folds
xxxxx calls [$0.71 USD]
** Dealing Turn ** [ 8h ]
xxxxx bets [$0.10 USD]
xxxxx calls [$0.10 USD]
** Dealing River ** [ 7d ]
xxxxx bets [$2.88 USD]
xxxxx folds
xxxxx does not show cards.
xxxxx wins $6.72 USD             // Filestream stops reading after this line
 Game #xxxxxxxxxx starts.


Any help would be appreciated

modified on Sunday, August 16, 2009 7:48 AM

AnswerRe: FileStream runtime issues Pin
Luc Pattyn15-Aug-09 14:38
sitebuilderLuc Pattyn15-Aug-09 14:38 
GeneralRe: FileStream runtime issues [modified] Pin
Mikey_H15-Aug-09 14:59
Mikey_H15-Aug-09 14:59 
AnswerRe: FileStream runtime issues Pin
riced15-Aug-09 23:09
riced15-Aug-09 23:09 
GeneralRe: FileStream runtime issues Pin
Mikey_H15-Aug-09 23:22
Mikey_H15-Aug-09 23:22 
AnswerRe: FileStream runtime issues (Updated) Pin
riced16-Aug-09 0:18
riced16-Aug-09 0:18 
GeneralRe: FileStream runtime issues (Updated) Pin
Mikey_H16-Aug-09 1:44
Mikey_H16-Aug-09 1:44 
GeneralRe: FileStream runtime issues (Updated) Pin
riced16-Aug-09 2:32
riced16-Aug-09 2:32 
GeneralRe: FileStream runtime issues (Updated) Pin
Mikey_H16-Aug-09 12:48
Mikey_H16-Aug-09 12:48 
QuestionReading letters from an Image in C# Pin
Sumit_Ghosh15-Aug-09 12:41
Sumit_Ghosh15-Aug-09 12:41 
AnswerRe: Reading letters from an Image in C# Pin
Henry Minute15-Aug-09 13:24
Henry Minute15-Aug-09 13:24 
QuestionWeb Browser(C# + other .NET technologies) Pin
abhifanatic15-Aug-09 10:12
abhifanatic15-Aug-09 10:12 
AnswerRe: Web Browser(C# + other .NET technologies) Pin
Saksida Bojan15-Aug-09 10:29
Saksida Bojan15-Aug-09 10:29 
QuestionC# IP Scanner Pin
nhqlbaislwfiikqraqnm15-Aug-09 10:06
nhqlbaislwfiikqraqnm15-Aug-09 10:06 
AnswerRe: C# IP Scanner Pin
Saksida Bojan15-Aug-09 10:31
Saksida Bojan15-Aug-09 10:31 
GeneralRe: C# IP Scanner Pin
nhqlbaislwfiikqraqnm15-Aug-09 10:52
nhqlbaislwfiikqraqnm15-Aug-09 10:52 
GeneralRe: C# IP Scanner Pin
Saksida Bojan15-Aug-09 18:57
Saksida Bojan15-Aug-09 18:57 
GeneralRe: C# IP Scanner Pin
nhqlbaislwfiikqraqnm15-Aug-09 21:55
nhqlbaislwfiikqraqnm15-Aug-09 21:55 

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.