c# - Why isn't there newline on this file write? -


i have written code compare 2 files , write common lines 3rd file. reason though 3rd file contains common lines has common lines written on 1 line. should 1 new line per common line..i have tried adding console.writeline('\n'); add new line separate common lines isn't helping. ideas wrong?

    //this program read  files , compares see if have line in common     //if there line in common writes common line new file   static void main(string[] args)     {          int counter = 0;         string line;         string sline;         string[] words;         string[] samacc = new string[280];           //first file compare         system.io.streamreader sfile =            new system.io.streamreader("c:\\desktop\\autoit\\new folder\\userlist.txt");         while ((sline = sfile.readline()) != null)         {             samacc[counter] = sline;             console.writeline();              counter++;         }          sfile.close();          //file write common lines to.         system.io.streamwriter wfile = new system.io.streamwriter("c:\\desktop\\autoit\\new folder\\kenuserlist.txt");          counter = 0;          //second file compare         system.io.streamreader file =            new system.io.streamreader("c:\\desktop\\autoit\\new folder\\alluserhomedirectories.txt");         while ((line = file.readline()) != null)         {             words = line.split('\t');              foreach (string in samacc)             {                 if (words[0] == i)                 {                      foreach (string x in words)                     {                         wfile.write(x);                         wfile.write('\t');                     }                     console.writeline('\n');                 }             }          }          file.close();          wfile.close();         // suspend screen.         console.readline();       } 

change console.writeline('\n'); wfile.writeline('\n');


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -