嘿,他最近在为一个项目编写这个程序的时间紧迫,并且遇到了将数据放入列表框的问题,这是我目前使用这个代码的情况(可能不太好,初学c ++编码器) 继承人代码:
string student[100][3];
int student_code = 1; //a unique student code for every student
ifstream InStudent;
InStudent.open("student.txt");
//Name of Student is stored in Subscript [0]
getline(InStudent, student[student_code][1], '#');
//Batch is stored in subscript [1]
getline(InStudent, student[student_code][2], '$');
//user name is stored in subscript [2]
getline(InStudent, student[student_code][3]);
student_code++;
//here i represents respective student code
for (int i = 1; i < student_code; i++)
{
int Index = 0;
HWND LIST;
LIST = GetDlgItem(hDlg, IDC_SNAMELIST);
string lpBuffer = student[i][0]; //ERROR on this line
SendMessage(LIST, LB_INSERTSTRING, Index, (LPARAM)lpBuffer[i][0]);
}