|
It could have been a good solution if I didn't mind the size of the output file. I have to know in advance if the block of lines I'm about to copy doesn't exceed 65000 lines per file. If it does than I need to split it into 2 consecutive files. That's why I scanned it in advance and saved the beginning and the end of the block in an array.
Inbal
|
|
|
|
|
While you are writing a line to the output file
manage a counter that will be the limit size of the output file
when the counter as reach the limit
close the stream and open a new for a new file
|
|
|
|
|
I recommend to you to do it on the fly, like other people is saying
The only thing you must be care about is to make the stream flush to prevent memory problems, i mean
void CopyLines(string inFile, string outFile){
StreamReader sr = new StreamReader(File.Open(inFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
StreamWriter sw = new StreamWriter(outFile);
string line;
while (!sr.EndOfStream) {
line = sr.ReadLine();
if ( Match(line) ) {
sw.WriteLine(line);
}
sw.Flush();
}
sr.Close();
sw.Close();
}
Maybe the Flush method should be not always called, i mean like if (i % 100 == 0) sw.Flush(), or use the AutoFlush property
Saludos!!
____Juan
|
|
|
|
|
|
Now you're just taking the p!ss.
|
|
|
|
|
tonyjsebastian1 wrote: How will you make .NET programs work in Linux ?
You've answered your own question:
tonyjsebastian1 wrote: mono
Yup...That's it...use mono.
tonyjsebastian1 wrote: what is mono????
Oh...hang on....I know the answer to this one.....
here[^]
Seriously, take a hint and, read this[^], and this[^], and this[^].
Don't know if you've noticed, but every time you post something it goes grey, this is because you are being an idiot. It's our subtle hint to you, if your post goes grey, it's a stupid post.
Simon
|
|
|
|
|
thanks for complements
|
|
|
|
|
I'm genuinely trying to help you. Read all the links I have given you. Learn how to use google first. Learn about forum etiquette, and learn how to ask smart questions. If you do this, you will get better answers to your questions. I've given you all the information you need to do this. No it is up to you to make use of the information and learn.
Simon
|
|
|
|
|
hello Simon Stevens
i have never expected these words from people like u
" this is because you are being an idiot "
thanks a lot
Tony
|
|
|
|
|
I'm only telling you the truth. You're never going to get answers to your questions if you keep asking them like you are. Learn from it and move on.
Simon
|
|
|
|
|
What everyone is trying to say is that programming's main requirement is you have a strong ability to do research. Without it, your career ends shortly after it begins because you haven't kept up on the technology changes whizzing by. For instance, everything your'e asking right now is easily solved with about 5 minutes worth of work using Google and a little experimentation. If you're stuck using a TextBox, you dig around for documentation and examples on the TextBox. If you don't konw how to use a ToolTip control, you Google the documentation, examples, and create your own little projects to test what you think you know and what you suspect. This process NEVER ends in this business. If you can't teach yourself, you're in the wrong line of work.
|
|
|
|
|
hello Simon Stevens
u realy hurt me i never forget this
i asked such questions bcz i am new in C# and not familiar with wht all C# have like u people knows
good bye
|
|
|
|
|
I hope you are *actually* leaving and not just teasing us!!
|
|
|
|
|
tonyjsebastian1 wrote: i asked such questions bcz i am new in C# and not familiar with wht all C# have like u people knows
Go to google, type in these keywords: .net linux
In general, for most of the answers in c#, go first to msdn website and search for what you are looking for. Microsoft has done such an awesome job in organizing the library and made it very easy to understand. If its not there, search in google.
I hope this helps you,
Prateek
p.s. I'm also a beginner, and believe me between msdn and google, most of my questions are answered.
|
|
|
|
|
|
tonyjsebastian1 wrote: i want to show a tool tip for the textbox in the Textchanged Event.
CONDITION
the tooltip must be displayed only if the text box types the correct data
Seems pretty straightforward. You already know to use the textchanged event. Use a ToolTip[^] to display the tooltip on the text box. In the textchanged event, just check that the type of data correct.
Simon
|
|
|
|
|
hi
I'm using Microsoft word library in c#
ples ineed to know what is instruction for selection title or sub title By style in the word document
ples any one answer
I'm watting
|
|
|
|
|
hatan86 wrote: I'm watting
I guess you probably are. Have you tried going into word and recording a macro doing what you want, then examining the macro?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
problem statement:
i want to detect and do some processing whenever the user types on any cell and leaves to another cell on the datagrid or even in another control, basically when the CELL that was typed on loses focus.
which event do i monitor? thanks!
----------------------------------------------------------
"unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep" - my daily unix command list
|
|
|
|
|
|
|
hello Simon Stevens
i expected to get EXPERTS advice rather than Google for clear ideas!
thks
Tony
|
|
|
|
|
Well don't ask questions so broad and basic then. Do you expect an expert to write you an detailed analysis of the complexities of interop every time you demand it?
You should use Google. Read all the articles and documentation you can find. Absorb and understand it. When you have a specific question, or when you have exhausted Google and have something you still don't understand, then ask specific questions. It helps to say what you have done already. E.g. "I've read this (link) article on MSDN, and I don't understand why it says 'this', I've tried Googling 'keywords' but I can't find an explanation, can anyone explain it". interop is a massive topic, and I'm sure you'll be able to find an answer to "what is interop" quite easily if you just put in a little bit of effort yourself. You'll find people here are more willing to help if you have shown that you are not lazy and are prepared to make the effort to learn when you need to rather than automatically running to others with simple questions.
What you are doing is showing that you are too lazy to the hard work of using google to find some articles and to read them thoroughly, what you are asking for us for someone here to do the hard work for you.
How to ask questions the smart way[^]
Simon
|
|
|
|
|
Simon Stevens wrote:
Have you tried Google?[^]
Nice one...
|
|
|
|
|
Do yourself a favour, buy a C# book, read it, read it again, then come back to ask real questions.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|