Click here to Skip to main content
15,911,785 members
Home / Discussions / C#
   

C#

 
GeneralRe: Select element from a List<> Pin
DPaul19945-Apr-15 0:48
DPaul19945-Apr-15 0:48 
GeneralRe: Select element from a List<> Pin
BillWoodruff5-Apr-15 1:48
professionalBillWoodruff5-Apr-15 1:48 
GeneralRe: Select element from a List<> Pin
DPaul19945-Apr-15 3:08
DPaul19945-Apr-15 3:08 
GeneralRe: Select element from a List<> Pin
BillWoodruff5-Apr-15 10:12
professionalBillWoodruff5-Apr-15 10:12 
GeneralRe: Select element from a List<> Pin
DPaul19945-Apr-15 10:16
DPaul19945-Apr-15 10:16 
SuggestionRe: Select element from a List<> Pin
Richard Deeming7-Apr-15 2:21
mveRichard Deeming7-Apr-15 2:21 
GeneralRe: Select element from a List<> Pin
DPaul19947-Apr-15 6:43
DPaul19947-Apr-15 6:43 
Questionneed to order a file in stream read and write c# Pin
Member 115700984-Apr-15 7:31
Member 115700984-Apr-15 7:31 
I have a new file every few seconds that looks like this: 23 45 21 1 9 23 42 22 40 11 33 32 18 11 12 32 22 7 37 30 in this text file to be read there is one number per line that will be between 1-40. these files are generated several times a minute. I am trying to order them ascending with stringreader and writer. my logic must be flawed as nothing shows up in this file i intended to send it to, i selected append= true but still nothing is populated in my sorted file. the goal was to read from the text file with the for loop which contains 1-40 int variables and compare that to each string or int from the file read and when found copy that from the read file into the sorted file in sorted order,I have been looking at it for a while and it should work but does not please help i have hit a brick wall and don't see why it does not work. would this be easier with the file reader/writer classes or streamreader/writer as i have done,thanks
C#
public static void ProcessDirectory()
      {
          int variable1;
          StreamReader readToSort = new StreamReader(@"C:write.txt");
          StreamWriter writeSorted = new StreamWriter(@"C:Sorted_File.txt", true);

      for (int i = 1; i > 41; i++)
      {
          variable1 = (readToSort.Read());

          while (!readToSort.EndOfStream)
          {
              if (variable1 == i)
              {
                  writeSorted.Write(i.ToString() + "\n");

              }

          }

          MessageBox.Show("processing #" + variable1);
      }
      readToSort.Close();
      writeSorted.Close();
  }


modified 4-Apr-15 14:02pm.

AnswerRe: need to order a file in stream read and write c# Pin
PIEBALDconsult4-Apr-15 8:03
mvePIEBALDconsult4-Apr-15 8:03 
GeneralRe: need to order a file in stream read and write c# Pin
Member 115700984-Apr-15 8:26
Member 115700984-Apr-15 8:26 
QuestionC# class constructor best practice ? Pin
BillWoodruff4-Apr-15 5:05
professionalBillWoodruff4-Apr-15 5:05 
GeneralRe: C# class constructor best practice ? Pin
PIEBALDconsult4-Apr-15 5:52
mvePIEBALDconsult4-Apr-15 5:52 
GeneralRe: C# class constructor best practice ? Pin
BillWoodruff4-Apr-15 8:21
professionalBillWoodruff4-Apr-15 8:21 
GeneralRe: C# class constructor best practice ? Pin
PIEBALDconsult4-Apr-15 8:27
mvePIEBALDconsult4-Apr-15 8:27 
AnswerRe: C# class constructor best practice ? Pin
Eddy Vluggen4-Apr-15 6:47
professionalEddy Vluggen4-Apr-15 6:47 
GeneralRe: C# class constructor best practice ? Pin
BillWoodruff4-Apr-15 8:28
professionalBillWoodruff4-Apr-15 8:28 
GeneralRe: C# class constructor best practice ? Pin
PIEBALDconsult4-Apr-15 8:50
mvePIEBALDconsult4-Apr-15 8:50 
GeneralRe: C# class constructor best practice ? Pin
Eddy Vluggen4-Apr-15 11:13
professionalEddy Vluggen4-Apr-15 11:13 
GeneralRe: C# class constructor best practice ? Pin
BillWoodruff4-Apr-15 21:42
professionalBillWoodruff4-Apr-15 21:42 
GeneralRe: C# class constructor best practice ? Pin
Eddy Vluggen5-Apr-15 13:13
professionalEddy Vluggen5-Apr-15 13:13 
QuestionIs there any solution to design report instead of Crystal? Pin
aahamdan4-Apr-15 4:14
aahamdan4-Apr-15 4:14 
AnswerRe: Is there any solution to design report instead of Crystal? Pin
OriginalGriff4-Apr-15 4:44
mveOriginalGriff4-Apr-15 4:44 
AnswerRe: Is there any solution to design report instead of Crystal? Pin
tecnova14-Apr-15 4:58
professionaltecnova14-Apr-15 4:58 
GeneralRe: Is there any solution to design report instead of Crystal? Pin
aahamdan4-Apr-15 10:14
aahamdan4-Apr-15 10:14 
GeneralRe: Is there any solution to design report instead of Crystal? Pin
tecnova18-Apr-15 14:54
professionaltecnova18-Apr-15 14:54 

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.