pointer to enum in gcc linux

os archlinux 64bit gcc


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct vect{
float x,y,z;
};
struct tchk{
enum g{i,l,m}; // i l m
float x,y,z;
vect vct;
};

int main(int argc,char **argv)
{
int i,j,k,N;
char str[256],s1[80],s2[80],s3[80];
char *s;
FILE *tmpf,*inf,*inf2,*outf;
tchk *buf,*bf,tch;

inf=fopen("fzad","rt");
outf=fopen("rez","wt");
N=0;
while(!feof(inf))
{
if( !fgets(str,80,inf) )
break;
N++;
}
buf=new tchk [N];
i=0;
bf=buf;
rewind(inf)
while(!feof(inf))
{
if( !fgets(str,80,inf) )
break;
j=sscanf(str," %char %f %f %f %f %f %f",&j,&bf->x,&bf->y,&bf->z,&bf->vct.x,&bf->vct.y,&bf->vct.z);
if(j=='i')
bf->g==tchk::i; errror invalid use of enum tchk::g
else
if(j=='l')
bf->g=tchk::l;
else
if(j=='m')
bf->g=tchk::m;
else
printf("error1 in %s", str);
bf++;
}


fcloseall();
return 0;
}

Last edited on
Change enum g{i,l,m}; to enum {i,l,m} g;
Thank you MiiNiPaa
Topic archived. No new replies allowed.