CheckPoints* read_file(char* file) { CheckPoints* cp = new CheckPoints; FILE * pfile; char line[LIN_MAX + 1]; pfile = fopen(file, "r"); if (pfile==NULL) { perror("Impossible to read the text.\n"); exit (EXIT_FAILURE); } while(fgets(line, LIN_MAX + 1, pfile) != NULL) { line[LIN_MAX] = '\0'; cp->add(parse_poly(line)); } fclose(pfile); return cp; }
int main(){ while((*sptr)!='='){ sptr++; }sptr++; ///Until the assignment operation then syntax analysis begin std::string s(sptr); change_fx(s); change_x(s,-1); float ret=parse_poly(s); std::cout<<"Expression After:"<<ret<<std::endl; system("pause"); return 0; }