NEED HELP: array of struct to read input file
I need to read 10lines of data containing 3fields.this is my code so far.....need help
struct Date
{
int Month, Day, Year;
}
static void Main(string[] args)
{
//This file was created with the Add New Item icon on the toolbar
StreamReader textReader = new StreamReader("..\\..\\Date.txt")
//array of struct to hold data from text file
Date[,] mydate = new Date[10, 3];
Date[indexcount, arraycount].Month;
Date[indexcount,arraycount].Day;
Date[indexcount, arraycount].Year;
//array counter
int outerloop = 0;
int indexcount = 0;
int arraycount = 0;
Sam HobbsPosted Jan 26, 2010, 12:05 PM
Sam HobbsPosted Jan 23, 2010, 3:48 PM
Will there always be one and only one colon in the first position? If so then you can use the String.Substring Method to get the data excluding the colon. Then you can use the String.Split Method to split the numbers that are separated by a space. Then use the Int32.TryParse Method to convert the characters to integers.
PrincePosted Jan 23, 2010, 7:23 AM
does it mean i don't need array to read all the 10 lines of my data file?
Sam HobbsPosted Jan 22, 2010, 4:15 PM