#include #include #include char *dodaj_apostrofy(const char *text) { char *temp=""; if (text==NULL) { temp=(char *)malloc(sizeof(char)*3); strcat(temp,"''"); return temp; } else { temp=(char *)malloc(sizeof(char)*(strlen(text)+3)); strcat(temp,"'"); strcat(temp,text); strcat(temp,"'"); return temp; } } char *losuj_liczbe() { FILE *plik; char *liczba; char znak; int i,j,z; plik=fopen("/proc/uptime","r"); fscanf(plik,"%d.%d",&j,&z); fclose(plik); liczba=(char *)malloc(sizeof(char)*6); i=5; srand(z+j); while(i--) { j=(int)(10.0*rand()/(RAND_MAX+1.0)); liczba[i]=48+j; } liczba[5]='\0'; return liczba; } int licz_znak(char *zmienna) { if (zmienna!=NULL) { return strlen(zmienna); } else { return 0; } }