Re: How to add a string to a big file in csharp !

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Zach (not_at_this.address)
Date: 11/04/04


Date: Thu, 4 Nov 2004 10:25:36 +0100


"zjut" <zjut@discussions.microsoft.com> wrote in message
news:A24189A5-46B4-473D-ADBC-2CBBE97394E8@microsoft.com...
> I want to add a string to the file and the file is sort by letter! for
> examply:
> the follow file is a big file
> //////////////////////
> abort
> black
> cabbage
> dog
> egg
> fly
> .
> .
> ////////////////////
> and now i want to add "dad" into it !

Given:
* Your file ("old_file") is in alphabetical order
* old_file is immensely big

Required:
* Adding word ("new_word") to old_file at the right place.

Solution:
* Sequentially read old_file ("word_read") and write word_read to new_file
* If (new_word > word_read) and (new_word< word_read+1) then shove it in



Relevant Pages

  • Alphabetical sorts
    ... I have several applications where I want to sort lists in alphabetical order. ... Most examples of sorting usually sort on the ordorder of the character set as an approximation. ... Maybe some sort of alphabetical order string could be easily referenced for various alphabets instead of having to create them manually? ...
    (comp.lang.python)
  • sorting a string collection
    ... Can anybody please tell me if it is possible to sort a string collection ... into alphabetical order. ... Please can somebody let me know the best way to implement a sort method -- ...
    (microsoft.public.dotnet.framework)
  • Re: sorting a string collection
    ... Can anybody please tell me if it is possible to sort a string ... into alphabetical order. ... "System.Collections.Specialized" namespace, however there does not ...
    (microsoft.public.dotnet.framework)
  • Re: VB6 LISTBOX problem
    ... Have a look at the code below, can you do a sort that is faster ... There are of course all sorts of ways of sorting stuff, especially stuf that is "linked together" as in your UDTs, but to prove the following code sorts it in exactly the same way that your own original code does so, by concatenating all three items of each element into a composite string exactly as you are already doing, but instead of dumping those composite strings into a ListBox it dumps them into a VB string array. ... Private Type SAFEARRAY1D ... Dim StPtr As Long, VAs String, pVAs Long ...
    (microsoft.public.vb.general.discussion)
  • C Sharp sorting considered superior to C by an order of magnitude
    ... following sort algorithms and the following points. ... its own comparision for the types bool, byte, short, int, long, ... single, double and string. ... private CheckBox CHKdeterminism; ...
    (comp.programming)