0
struture파일에 동적으로 할당 된 다차원 구조체 배열을 쓰려면 어떻게해야합니까?
struct str
{
int a;
char b[20];
int c;
}
선언
struct str ** str_array=0;
str_array= new struct str*[100];
for(int i=0;i<100;++i)
str_array[i]=new struct str[1000];
for(int i=0;i<100;++i)
for(int j=0;j<1000;++j;
str_array[i][j].a=j;
.....
이제 I 같이 어레이의 콘텐츠를 작성하려고 할당 및 초기화 (사용)
for(int i=0;i<100;++i)
for(int j=0;j<1000;++j;
fwrite(str_array[i][j],sizeof(str),1,fname);
문제
더 적합한 변환 STR에서에 const를 무효 *이 내가 같은 스타일로 읽어하려는
존재한다.
은 당신이 부스트 :: 직렬화 생각 해 봤나? – Scottymac