Click here to Skip to main content
15,900,110 members
Home / Discussions / C#
   

C#

 
GeneralRe: Military (Midnight) DateTime subtraction Pin
Jacob D Dixon8-Feb-09 10:24
Jacob D Dixon8-Feb-09 10:24 
AnswerRe: Military (Midnight) DateTime subtraction Pin
PIEBALDconsult8-Feb-09 12:36
mvePIEBALDconsult8-Feb-09 12:36 
AnswerRe: Military (Midnight) DateTime subtraction Pin
Luc Pattyn8-Feb-09 12:50
sitebuilderLuc Pattyn8-Feb-09 12:50 
GeneralRe: Military (Midnight) DateTime subtraction Pin
Guffa8-Feb-09 14:17
Guffa8-Feb-09 14:17 
AnswerRe: Military (Midnight) DateTime subtraction Pin
Luc Pattyn8-Feb-09 14:41
sitebuilderLuc Pattyn8-Feb-09 14:41 
GeneralRe: Military (Midnight) DateTime subtraction Pin
PIEBALDconsult8-Feb-09 15:46
mvePIEBALDconsult8-Feb-09 15:46 
QuestionPosition in char array Pin
Sue19708-Feb-09 7:28
Sue19708-Feb-09 7:28 
AnswerRe: Position in char array Pin
Luc Pattyn8-Feb-09 7:49
sitebuilderLuc Pattyn8-Feb-09 7:49 
Hi,

this does not make sense whatsoever, your code is too complex and bound to be slow: you are reading a char array, then turning it into a huge string (that is copying all chars), then getting a substring (again copying all chars), then splitting it in a string array (copying all chars again), and now you are worrying about incomplete lines, so after all that effort you still don't have want you want.

Of course you should read lines right away, either with Stream.ReadLine() or even File.ReadAllLines() if your file size is small with respect to your physical memory. ("I have to read large files" does not tell us much). That would be much simpler, faster and less error-prone.

If you insist on reading char arrays your way, you could throw back the incomplete line at the end of your buffer by repositioning your stream (with reader.BaseStream.Seek as you already did somewhere).

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles]

- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


modified on Friday, June 10, 2011 11:33 PM

GeneralRe: Position in char array Pin
Sue19708-Feb-09 8:15
Sue19708-Feb-09 8:15 
AnswerRe: Position in char array Pin
Luc Pattyn8-Feb-09 8:38
sitebuilderLuc Pattyn8-Feb-09 8:38 
AnswerRe: Position in char array Pin
PIEBALDconsult8-Feb-09 12:46
mvePIEBALDconsult8-Feb-09 12:46 
GeneralRe: Position in char array Pin
Sue19709-Feb-09 2:23
Sue19709-Feb-09 2:23 
QuestionString Problem Pin
nike_arh8-Feb-09 7:13
nike_arh8-Feb-09 7:13 
AnswerRe: String Problem Pin
Alan N8-Feb-09 7:32
Alan N8-Feb-09 7:32 
GeneralRe: String Problem Pin
nike_arh8-Feb-09 7:41
nike_arh8-Feb-09 7:41 
GeneralRe: String Problem Pin
nike_arh8-Feb-09 8:40
nike_arh8-Feb-09 8:40 
GeneralRe: String Problem Pin
Guffa8-Feb-09 13:19
Guffa8-Feb-09 13:19 
Questionproblem read RTF file image section produce the image Pin
Ravenet8-Feb-09 6:07
Ravenet8-Feb-09 6:07 
AnswerRe: problem read RTF file image section produce the image Pin
Alan N8-Feb-09 8:05
Alan N8-Feb-09 8:05 
GeneralRe: problem read RTF file image section produce the image Pin
Ravenet8-Feb-09 14:50
Ravenet8-Feb-09 14:50 
AnswerRe: problem read RTF file image section produce the image Pin
Jani Giannoudis13-Feb-09 5:34
mvaJani Giannoudis13-Feb-09 5:34 
GeneralRe: problem read RTF file image section produce the image Pin
Ravenet13-Feb-09 5:37
Ravenet13-Feb-09 5:37 
AnswerRe: problem read RTF file image section produce the image Pin
Jani Giannoudis13-Feb-09 6:24
mvaJani Giannoudis13-Feb-09 6:24 
GeneralRe: problem read RTF file image section produce the image Pin
Ravenet13-Feb-09 15:28
Ravenet13-Feb-09 15:28 
AnswerRe: problem read RTF file image section produce the image Pin
Jani Giannoudis13-Feb-09 21:04
mvaJani Giannoudis13-Feb-09 21:04 

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.