File I/O with Windows Forms

I need to create a program with Windows forms. i made a bit of code in c++...and Windows forms in c++/cli at the same time. now i m trying to adapt the c++ code in the forms..but i m having some problem with file.it s completely different from c++.

i have 2 forms.the first is for registration(it should register every student in a file).the second is for modify students data with a given surname for example..

in registration.cpp i created a list of object but when i Write i use streamwriter..but i guess there isnt any relationship with my list.

so the problem are: how can i WRITE my data list in a file? how can i MODIFY those data?

now i post some code..but its quite in italian :D as i am from italy (and sorry for my mistakes..)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//.cpp of the registration

class studente
{
private:
      string cognome;
string nome;
public:
 studente(){
    cognome="";
    nome="";
    };
~studente(){};
void set(string str1,string str2){
                               cognome=str1;
                               nome=str2;
               }

class primo_anno:public studente
{
private:
 int voto_diploma;
public:
 primo_anno(){
       cognome="";
       nome="";
             voto_diploma='0';
    };
 ~primo_anno(){};
 void set(string str1,string str2, int mark){                                                voto_diploma=mark;                                };
 void stampa(){//I KNOW ITS NOT USEFUL HERE..BUT IN C++ I USED THAT
        f<<"\ncognome: "<<cognome<<"\n";
        f<<"nome:    "<<nome<<"\n";
        f<<"voto:    "<<voto_diploma<<"\n";
        };
};

list<primo_anno> l1;//DECLARE MY STL LIST

{//WHEN I CLICK ON MY REGISTER BUTTON THE PROGRAM RUN THIS
int mark;
primo_anno *s;
s=new primo_anno;

char* str1=(char*)(Marshal::StringToHGlobalAnsi(textBox1->Text)).ToPointer();
char* str2=(char*)(Marshal::StringToHGlobalAnsi(textBox2->Text)).ToPointer();
mark = Convert::ToInt16(textBox35->Text);

s->set(str1,str2,mark);
l1.push_back(*s);
list<primo_anno>::iterator it;

//I HAVE FOUND THIS METHOD BUT ITS NOT LINKED TO MY STL LIST.
//BY THE WAY I AM ABLE TO WRITE ON FILE WITH THIS.BUT LATER I DONT KNOW HOW TO MODIFY
//FOR EXAMPLE "DELETE THE LINE WHERE THERE IS Rossi SURNAME".HOW!!!
TextWriter ^tw = gcnew StreamWriter("primoAnno.txt", true);//true append
tw->WriteLine(textBox1->Text + "\t\t" + textBox2->Text + "\t\t" + textBox35->Text);
tw->Close();

thank you in advice! and sorry again for my english..im just a student:)
Topic archived. No new replies allowed.