#include "const.h" #include #include #include #include #include // napisy zostaj na miejscu (w line), tylko wskazniki sa ustawian // i zara dopisywane zera s dopisywane inline int parsetok(char* line, int* a, int* b, char** c, char** d, char** e, char** f) { char* field; if((field=strtok(line,FIELD_SEP))!=NULL) *a=atoi(field); // nie sprawdzana poprawnosc else return 0; if((field=strtok(NULL,FIELD_SEP))!=NULL) *b=atoi(field); // nie sprawdzana poprawnosc else return 1; if((*c=strtok(NULL,FIELD_SEP))==NULL) return 2; if((*d=strtok(NULL,FIELD_SEP))==NULL) return 3; if((*e=strtok(NULL,FIELD_SEP))==NULL) return 4; if((*f=strtok(NULL,FIELD_SEP))==NULL) return 6; return 6; } // napisy s kopiowane inline int scantok(const char* line, int* a, int* b, char* c, char* d, char* e=NULL, char* f=NULL) { return sscanf(line," %d %d %s %s %s %s", a, b, c, d, e, f); } inline int printtok(char* line, int a, int b, char* c, char* d, char* e, char* f, char* parms) { sprintf(line,"%04d %02d %s %s %s %s `%s\n", a, b, c, d, e, f, parms); } inline int printtok(char* line, int a, int b, char* c, char* d, char* e, char* f) { sprintf(line,"%04d %02d %s %s %s %s\n", a, b, c, d, e, f); } inline int printtok(char* line, int a, int b, char* c, char* d) { sprintf(line,"%04d %02d %s %s\n", a, b, c, d); }