Привет,
Надо под VBA сохранить структуру в бинарный файл, а потом прочитает ее из под с++
Делаю следующие
VBA:
Private Type TestBinRecord ' Define user-defined type.
NamePac As String * 20
A As Integer
B As Integer
H As Integer
Kappa As Integer
Thikness As Integer
Smax As Integer
End Type
Private NewType As TestBinRecord
Private Sub CommandButton1_Click()
NewType.NamePac = "TEst"
NewType.A = 2
NewType.B = 2
NewType.H = 2
Open "c:\TestBinFile.dat" For Binary Access Write As #1
' Close before reopening in another mode.
Put #1, , NewType
Close #1
End Sub
C++:
struct{
char NamePac[20];
int A;
int B;
int H;
int Kappa;
int Thikness;
int Smax;
} TestBinRecord;
FILE *fbread = fopen("c:\\TestBinFile.dat","rb");
fread(&TestBinRecord,sizeof(TestBinRecord),1,fbread);
fclose (fbread);
В результате считывается фигня, и что делать?
22.12.04 20:30: Перенесено модератором из 'C/C++' — Павел Кузнецов