Click here to Skip to main content
15,919,028 members
Home / Discussions / C#
   

C#

 
AnswerRe: To get shortcuts(icons) of documents stored in SQL server Pin
joon vh.1-Apr-07 21:41
joon vh.1-Apr-07 21:41 
QuestionQuestion on deleting a file once the user closes the application? Pin
Khoramdin1-Apr-07 5:23
Khoramdin1-Apr-07 5:23 
AnswerRe: Question on deleting a file once the user closes the application? Pin
Leslie Sanford1-Apr-07 5:50
Leslie Sanford1-Apr-07 5:50 
Questionfast processing techniques required to process text files greater than 35 GB! Pin
Adeel Chaudhry1-Apr-07 2:38
Adeel Chaudhry1-Apr-07 2:38 
AnswerRe: fast processing techniques required to process text files greater than 35 GB! Pin
DavidNohejl1-Apr-07 4:21
DavidNohejl1-Apr-07 4:21 
GeneralRe: fast processing techniques required to process text files greater than 35 GB! Pin
Adeel Chaudhry1-Apr-07 5:40
Adeel Chaudhry1-Apr-07 5:40 
GeneralRe: fast processing techniques required to process text files greater than 35 GB! Pin
CPallini1-Apr-07 5:54
mveCPallini1-Apr-07 5:54 
AnswerRe: fast processing techniques required to process text files greater than 35 GB! Pin
Guffa1-Apr-07 4:25
Guffa1-Apr-07 4:25 
I am not surprised that the code takes a lot of time to run. You are creating one or two strings for every character you read, so to process a 500 MB file, you will have created about 1000 million string objects.

If you want to remove all line breaks and put line breaks before the keywork, why not simply:

string line;
string newLineMatchWord = "\r\n" + matchWord;
while ((line = inputReader.ReadLine()) != null) {
   outputWriter.Write(line.Replace(matchWord, newLineMatchWord));
}


The Replace method returns a reference to the same string if no change was made, so it will only create a new string for lines that actually contain the keyword.

If the file can start with the keyword, you have to add some code to handle that before the loop. As this occurs only once, it should definitely be handled in separate code before the loop, and not inside the loop.

---
single minded; short sighted; long gone;

GeneralRe: fast processing techniques required to process text files greater than 35 GB! Pin
Adeel Chaudhry1-Apr-07 5:43
Adeel Chaudhry1-Apr-07 5:43 
GeneralRe: fast processing techniques required to process text files greater than 35 GB! Pin
Guffa1-Apr-07 20:59
Guffa1-Apr-07 20:59 
GeneralRe: fast processing techniques required to process text files greater than 35 GB! Pin
mabo422-Apr-07 1:26
mabo422-Apr-07 1:26 
GeneralRe: fast processing techniques required to process text files greater than 35 GB! Pin
mabo422-Apr-07 1:38
mabo422-Apr-07 1:38 
QuestionStarup object Pin
Tauseef A1-Apr-07 2:18
Tauseef A1-Apr-07 2:18 
AnswerRe: Starup object Pin
Mike Hankey1-Apr-07 2:46
mveMike Hankey1-Apr-07 2:46 
QuestionSimple Password Form compare using database.Tq Pin
krajah101-Apr-07 1:43
krajah101-Apr-07 1:43 
Questionthis one is more understandable:D Pin
yvzhn1-Apr-07 0:36
yvzhn1-Apr-07 0:36 
AnswerRe: this one is more understandable:D Pin
Wayne Phipps1-Apr-07 0:49
Wayne Phipps1-Apr-07 0:49 
AnswerRe: this one is more understandable:D Pin
Colin Angus Mackay1-Apr-07 1:07
Colin Angus Mackay1-Apr-07 1:07 
AnswerRe: this one is more understandable:D Pin
Professor Sharada Ulhas1-Apr-07 11:21
Professor Sharada Ulhas1-Apr-07 11:21 
Questionneed a simple solution Pin
yvzhn1-Apr-07 0:27
yvzhn1-Apr-07 0:27 
AnswerRe: need a simple solution Pin
Wayne Phipps1-Apr-07 0:54
Wayne Phipps1-Apr-07 0:54 
AnswerRe: need a simple solution Pin
Guffa1-Apr-07 4:40
Guffa1-Apr-07 4:40 
QuestionHow to make the "flying ball" to be in the front ? Pin
Saikek31-Mar-07 23:58
Saikek31-Mar-07 23:58 
AnswerRe: How to make the "flying ball" to be in the front ? Pin
CPallini1-Apr-07 0:41
mveCPallini1-Apr-07 0:41 
QuestionHow to access one form to another? [modified] Pin
Saikek31-Mar-07 23:52
Saikek31-Mar-07 23:52 

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.