Click here to Skip to main content
16,003,224 members
Home / Discussions / C#
   

C#

 
GeneralRe: Parsing Line by line Pin
alwaysthinking17-Feb-09 13:35
alwaysthinking17-Feb-09 13:35 
GeneralRe: Parsing Line by line Pin
PIEBALDconsult17-Feb-09 15:21
mvePIEBALDconsult17-Feb-09 15:21 
Question[Message Deleted] Pin
wwwxyz17-Feb-09 10:08
wwwxyz17-Feb-09 10:08 
AnswerRe: how can I apply all txt files in the folder this code? Pin
DaveyM6917-Feb-09 10:19
professionalDaveyM6917-Feb-09 10:19 
General[Message Deleted] Pin
wwwxyz17-Feb-09 10:24
wwwxyz17-Feb-09 10:24 
GeneralRe: how can I apply all txt files in the folder this code? Pin
Calin Tatar17-Feb-09 10:36
Calin Tatar17-Feb-09 10:36 
General[Message Deleted] Pin
wwwxyz17-Feb-09 10:39
wwwxyz17-Feb-09 10:39 
GeneralRe: how can I apply all txt files in the folder this code? Pin
Calin Tatar17-Feb-09 10:56
Calin Tatar17-Feb-09 10:56 
something like this, you should review it because you know what exactly to read from console,...:

...
//read filePath


foreach(string inFile in Directory.GetFiles(filePath))
{
  ...
  StreamReader sr = File.OpenText(inFile);            
  line = sr.ReadLine();            
  Console.WriteLine();            
  Console.WriteLine("Successful file open!...");            
  Console.WriteLine();
  Console.WriteLine("Input file name to save!");            
  Console.WriteLine("sample: d:\\filename.txt");            
  filePath = Console.ReadLine();
  FileStream file = new FileStream(filePath, FileMode.Create);              
  StreamWriter sw = new StreamWriter(file);    
  List lines = new List();            

  while ((line = sr.ReadLine()) != null)            
  {                
    lines.Add(line);            
  } 
  try           
  {                
    int numberOne = Int32.Parse(lines[0]);  
    int numberTwo = Int32.Parse(lines[1]);                
    int numberThree = Int32.Parse(lines[2]);                
    int x = numberOne + numberTwo + numberThree;                
    sw.WriteLine(x);            
  }            
  catch { }
  sw.Close();
  sr.Close();
}


Calin
GeneralRe: how can I apply all txt files in the folder this code? Pin
wwwxyz17-Feb-09 11:35
wwwxyz17-Feb-09 11:35 
GeneralRe: how can I apply all txt files in the folder this code? Pin
Calin Tatar17-Feb-09 11:40
Calin Tatar17-Feb-09 11:40 
GeneralRe: how can I apply all txt files in the folder this code? Pin
wwwxyz17-Feb-09 10:35
wwwxyz17-Feb-09 10:35 
AnswerRe: [Message Deleted] Pin
wwwxyz18-Feb-09 12:01
wwwxyz18-Feb-09 12:01 
QuestionDatagridview Columns modifier Pin
Priya Prk17-Feb-09 8:53
Priya Prk17-Feb-09 8:53 
AnswerRe: Datagridview Columns modifier Pin
Calin Tatar17-Feb-09 9:14
Calin Tatar17-Feb-09 9:14 
QuestionSharepoint Development - Where to Start? Pin
rkajal17-Feb-09 6:05
rkajal17-Feb-09 6:05 
AnswerRe: Sharepoint Development - Where to Start? Pin
ToddHileHoffer17-Feb-09 6:26
ToddHileHoffer17-Feb-09 6:26 
GeneralRe: Sharepoint Development - Where to Start? Pin
rkajal17-Feb-09 6:40
rkajal17-Feb-09 6:40 
GeneralRe: Sharepoint Development - Where to Start? Pin
ToddHileHoffer17-Feb-09 6:58
ToddHileHoffer17-Feb-09 6:58 
GeneralRe: Sharepoint Development - Where to Start? Pin
led mike17-Feb-09 7:08
led mike17-Feb-09 7:08 
GeneralRe: Sharepoint Development - Where to Start? Pin
rkajal17-Feb-09 10:11
rkajal17-Feb-09 10:11 
GeneralRe: Sharepoint Development - Where to Start? Pin
led mike17-Feb-09 11:04
led mike17-Feb-09 11:04 
GeneralRe: Sharepoint Development - Where to Start? Pin
rkajal17-Feb-09 10:13
rkajal17-Feb-09 10:13 
QuestionDllImport Pin
Alessio Granzotto17-Feb-09 5:44
Alessio Granzotto17-Feb-09 5:44 
AnswerRe: DllImport Pin
Luc Pattyn17-Feb-09 6:16
sitebuilderLuc Pattyn17-Feb-09 6:16 
GeneralRe: DllImport Pin
Alessio Granzotto17-Feb-09 6:30
Alessio Granzotto17-Feb-09 6:30 

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.