środa, 11 listopada 2020

Writing a StringGrid to a file (C++ Builder)

#include <Grids.hpp>


 void __fastcall TForm1::save_SG(TStringGrid *table,UnicodeString filename)

{

UnicodeString **values;


int i,j,size_x,size_y;

size_x=table->ColCount;

size_y=table->RowCount;

values=new UnicodeString *[size_x];

for(i=0;i<size_x;i++)

values[i]=new UnicodeString[size_y];

for(i=0;i<size_x;i++)

for(j=0;j<size_y;j++)

  values[i][j]=table->Cells[i][j];

std::auto_ptr<TStreamWriter> write_Data(new TStreamWriter(filename,false));

for(i=0;i<size_x;i++)

for(j=0;j<size_y;j++)

  write_Data->WriteLine(values[i][j]);

for(i=0;i<size_x;i++)


delete [] values[i];

    delete [] values;

}

YOU CAN PAY ME - https://paypal.me/LukaszW77?locale.x=pl_PL

Brak komentarzy:

Prześlij komentarz