Witam mam kod:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
struct para
{
char napis[100];
char liczba[20];
};
int wiersz(FILE* f, struct para *p)
{
fscanf(f, "%s %s", p.napis, p.liczba);
return 0;
}
/*int wiersz(FILE* f, struct para *p)
{
int i, a = 0;
for (i = 0; i < 5; i++)
{
fscanf(f, "%s %s %s", p[i].napis, p[i].napis, p[i].liczba);
}
return 0;
};*/
int main()
{
para q[5];
char a[40];
char b[40];
cout<<"Podaj nazwe pliku z danymi pamietaj o rozszerzeniu pliku"<<endl;
cin>>a;
FILE *f=fopen(&a[0],"r");
if (f == NULL)
{
cout<<"Nie udalo sie otworzyc pliku notatki.txt"<<endl;
return 1;
}
else
{
cout<<"Plik otwarty pomyslnie!"<<endl;
}
int zwracana;
zwracana = wiersz(f,q);
/*for(int i=0;i<5;i++)
{
fscanf(f, "%s %s %s", p[i].napis, p[i].napis, p[i].liczba);
cout<<i<<endl;
}
;
*/
return 0;
}
otrzymuje błąd:
Error 2 error C2228: left of '.liczba' must have class/struct/union
nie do konca wiem o co chodzi. Jakies rady?