Subj : structures problem To : borland.public.cpp.borlandcpp From : Viktor Popov Date : Sat Jul 24 2004 06:30 pm Hi, I have a problem reading a file and outputing the result using structers.Could you check this code and if you see something that is not correct, please let me know, because I am really upset.My code looks like: #include #include #include #include #include char *AtomNumber(char *str,int start); struct SSEList *BuildSSE(FILE *fp,struct SSEList *sse); void PrintSSE(struct SSEList *sse,int br); struct SSEList{ char type[5]; ----------------------------->I don't use this. If I comment this row everything goes wrong.... the first element of the structure is not the right one. int num_beg; int num_end; }*sse; FILE *fp; char *file_name; int br; int main(int argc,char *argv[]) { if((sse=(struct SSEList *)malloc(100*sizeof(struct SSEList)))==NULL) { printf("\nAllocation error!"); return 1; } clrscr(); fflush(stdin); //iz4istwa buferite if(argc<2){ printf("Nepravilno vavedeni parametri na programata!"); return(1); } if((fp = fopen(argv[1], "r")) == NULL){ printf("Error opening file.\n"); return(1); } file_name=argv[1]; printf("Opening file %s\n",file_name); struct SSEList *s=(struct SSEList *)malloc(100*sizeof(struct SSEList)); s = BuildSSE(fp,sse); PrintSSE(s,br); free(sse);free(s); fclose(fp); getch(); return 0; } char *AtomNumber(char *str,int start,int final) { char *number; int num_i=0; number[0]='\0'; for(int i=start;i