Hello,
I'm new in C++.I made up 680x680 two dimensional array.And I tried to write it to txt file.Unfortunately,I can't write two dimensional array along its dimensions regularly. Also I want to read two dimensional array from txt file.My code is below.Could you help me ?
/*Declaration 680 *680 multidimensional array*/
array< array< double >^ >^ arr = gcnew array< array< double >^ >(680);
for (j=0;j<arr->Length;j++){
arr[j]=gcnew array<double>(680);}
/*Write double array to file*/
FILE *OutFile = fopen("C:\\test.txt","w++");
for(n=0;n<=(N-1);n++){
fprintf(OutFile,"\n ");
for(k=0;k<=(N-1);k++){
fprintf(OutFile,"\t %f ",dizi[n][k]);}}
fclose(OutFile);
/* Declaration array reading from file*/
array< array< double >^ >^ read = gcnew array< array< double >^ >(680);
for (j=0;j<read->Length;j++){
read[j]=gcnew array<double>(680);}
/* reading array from file*/
FILE *InFile = fopen("C:\\test.txt","r");
double db;
for(n=0;n<=(N-1);n++){
for(k=0;k<=(N-1);k++){
fscanf(InFile,"\t %f ",&db);
read[n][k]=db; }}
fclose(InFile);
Best Regards...