środa, 8 lutego 2023

Project files in ListBoxes - Visual C++


 #pragma endregion

private:

String^ char_to_String(char* value)

{

String^ result = gcnew String(value);

return result;

}

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

char* name1 = "Form1.h";

char* name2 = "Form1.cpp";

char* name3 = "pch.h";

char* name4 = "pch.cpp";

char* name5 = "Resource.h";

String^ temp;

char buff1[10000], buff2[10000], buff3[10000], buff4[10000], buff5[10000];

ifstream file1(name1);

if (file1.is_open())

{

while (file1.getline(buff1, 1000))

{

temp = char_to_String(buff1);

listBox1->Items->Add(temp);

}

file1.close();

}

ifstream file2(name2);

if (file2.is_open())

{

while (file2.getline(buff2, 1000))

{

temp = char_to_String(buff2);

listBox2->Items->Add(temp);

}

file2.close();

}

ifstream file3(name3);

if (file3.is_open())

{

while (file3.getline(buff3, 1000))

{

temp = char_to_String(buff3);

listBox3->Items->Add(temp);

}

file3.close();

}

ifstream file4(name4);

if (file4.is_open())

{

while (file4.getline(buff4, 1000))

{

temp = char_to_String(buff4);

listBox4->Items->Add(temp);

}

file4.close();

}

ifstream file5(name5);

if (file5.is_open())

{

while (file5.getline(buff5, 1000))

{

temp = char_to_String(buff5);

listBox5->Items->Add(temp);

}

file5.close();

}


}

Brak komentarzy:

Prześlij komentarz