Click here to Skip to main content
15,884,099 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating Custom Encoding Pin
harold aptroot6-Mar-10 22:59
harold aptroot6-Mar-10 22:59 
GeneralRe: Creating Custom Encoding Pin
Xmen Real 6-Mar-10 23:45
professional Xmen Real 6-Mar-10 23:45 
GeneralRe: Creating Custom Encoding Pin
OriginalGriff6-Mar-10 22:57
mveOriginalGriff6-Mar-10 22:57 
GeneralRe: Creating Custom Encoding Pin
Xmen Real 6-Mar-10 23:45
professional Xmen Real 6-Mar-10 23:45 
Questionchange the cell type of a datagrid view in runtime Pin
TAFIN6-Mar-10 18:52
TAFIN6-Mar-10 18:52 
Questionstopping a waitcallback in a threadpool Pin
Jason Jerome6-Mar-10 12:18
Jason Jerome6-Mar-10 12:18 
AnswerRe: stopping a waitcallback in a threadpool Pin
Luc Pattyn6-Mar-10 16:25
sitebuilderLuc Pattyn6-Mar-10 16:25 
QuestionHow to search for a specific string in a file? Pin
SimpleData6-Mar-10 11:09
SimpleData6-Mar-10 11:09 
Hi,
Let's say that I've a file and I would like to find a specific string's location inside it. It is logical to load my file into a byte array and then parse it into a string or a StringBuilder byte by byte, right? It is an easy issue if the file is small.

If the file is huge (like 400megabytes), it is not that easy. The application demands lots of RAM and it is annoying. I thought about copying the file into the byte array by 100 bytes, step by step. But this brings another problem, if the half of my string is inside the first 100 bytes, and the rest in the next 100 bytes; my application is not able to identify my string and therefore give its location to me.

How can I solve this, any ideas?

If there is anything unclear, feel free to ask.
Thanks.
AnswerRe: How to search for a specific string in a file? Pin
StarBP6-Mar-10 11:17
StarBP6-Mar-10 11:17 
GeneralRe: How to search for a specific string in a file? Pin
SimpleData6-Mar-10 11:24
SimpleData6-Mar-10 11:24 
GeneralRe: How to search for a specific string in a file? Pin
StarBP6-Mar-10 11:28
StarBP6-Mar-10 11:28 
GeneralRe: How to search for a specific string in a file? Pin
SimpleData6-Mar-10 11:35
SimpleData6-Mar-10 11:35 
AnswerRe: How to search for a specific string in a file? [modified] Pin
harold aptroot6-Mar-10 11:32
harold aptroot6-Mar-10 11:32 
GeneralRe: How to search for a specific string in a file? Pin
SimpleData6-Mar-10 11:35
SimpleData6-Mar-10 11:35 
GeneralRe: How to search for a specific string in a file? Pin
harold aptroot6-Mar-10 11:37
harold aptroot6-Mar-10 11:37 
GeneralRe: How to search for a specific string in a file? Pin
Luc Pattyn6-Mar-10 12:11
sitebuilderLuc Pattyn6-Mar-10 12:11 
GeneralRe: How to search for a specific string in a file? [modified] Pin
harold aptroot6-Mar-10 12:21
harold aptroot6-Mar-10 12:21 
GeneralRe: How to search for a specific string in a file? Pin
SimpleData7-Mar-10 4:05
SimpleData7-Mar-10 4:05 
GeneralRe: How to search for a specific string in a file? Pin
Luc Pattyn7-Mar-10 8:41
sitebuilderLuc Pattyn7-Mar-10 8:41 
GeneralRe: How to search for a specific string in a file? Pin
SimpleData7-Mar-10 8:47
SimpleData7-Mar-10 8:47 
GeneralRe: How to search for a specific string in a file? Pin
Luc Pattyn7-Mar-10 9:09
sitebuilderLuc Pattyn7-Mar-10 9:09 
GeneralRe: How to search for a specific string in a file? Pin
SimpleData7-Mar-10 9:11
SimpleData7-Mar-10 9:11 
AnswerRe: How to search for a specific string in a file? Pin
Shane55557-Mar-10 3:28
Shane55557-Mar-10 3:28 
QuestionPlease help as i cant remember how to do this..... Pin
stephen.darling6-Mar-10 10:41
stephen.darling6-Mar-10 10:41 
AnswerRe: Please help as i cant remember how to do this..... Pin
StarBP6-Mar-10 11:05
StarBP6-Mar-10 11:05 

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.