public int ReadAllRecords() { m_studList.Clear(); m_nMaxStudents = 0; if (System.IO.File.Exists(filename) == false) { return(0); } System.IO.Stream s1 = System.IO.File.Open(filename, System.IO.FileMode.Open); System.IO.BinaryReader f1 = new System.IO.BinaryReader(s1); m_nMaxStudents = f1.ReadInt32(); for (int i = 0; i < m_nMaxStudents; i++) { CStudent stud = new CStudent(); stud.name = f1.ReadString(); for (int j = 0; j < 5; j++) { stud.marks[j] = f1.ReadInt32(); } stud.total = f1.ReadInt32(); m_studList.Add(stud); } f1.Close(); return(m_nMaxStudents); }
public int EditRecord(int index, string name, int[] marks) { CStudent stud = new CStudent(); stud.name = name; stud.marks = marks; stud.total = 0; m_studList[index] = stud; m_nMaxStudents = m_studList.Count; WriteAllRecords(); return(1); }