27 t_error(
"You tried to read from a closed file ");
35 while(!isspace(ch) && !iscntrl(ch)){
37 fseek(inputfile,position,SEEK_SET);
41 if(strcmp(h.
name,
string)==0){
42 fseek(inputfile,position,SEEK_SET);
46 t_error(
"The searched array does not exists in file");
84 t_error(
"You tried to read from a closed file ");
94 while(!isspace(ch) && !iscntrl(ch)){
96 fseek(inputfile,position,SEEK_SET);
102 fseek(inputfile,position,SEEK_SET);
108 t_error(
"The searched array does not exists in file");
121 long position=0,stringlength=0,counter=0;
122 char ch=
'a', *newstring;
124 stringlength=strlen(
string);
125 newstring=(
char *)malloc((stringlength+1)*
sizeof(char));
126 if(newstring==NULL)
t_error(
"Not enough memory to allocate this string");
128 newstring[stringlength]=
'\0';
134 if(ch==EOF)
return EOF;
136 position=ftell(istream);
139 while(counter < stringlength){
140 newstring[counter]=getc(istream);
141 if(newstring[counter]==EOF)
return EOF;
144 newstring[counter]=
'\0';
145 if(strcmp(newstring,
string)==0){
149 fseek(istream,position,SEEK_SET);
159 fseek(istream,position-1,SEEK_SET);
170 void meter(
long index,
long rows,
short frequence,
const char* message,
const char* separator)
175 printf(
"%s %ld/%ld%s", message, index,rows,separator);
177 m=ceil (rows/frequence);
178 if( (index % m )==0){
179 printf(
"%s %ld/%ld%s", message, index,rows,separator);
191 long position=0,stringlength=0,counter=0,pos=0,n;
195 stringlength=strlen(
string);
196 newstring=(
char *)malloc((stringlength+1)*
sizeof(char));
197 if(newstring==NULL)
t_error(
"Not enough memory to allocate this string");
198 newstring[stringlength]=
'\0';
200 while( position <=bufferlength){
202 while(isspace(buffer[position] && position <= bufferlength)){
205 newstring[counter]=toupper(buffer[position]);
207 if(newstring[counter]==
string[0]) {
210 while(counter < stringlength && position <= bufferlength){
211 if(isspace(buffer[position] )){
214 newstring[counter]=toupper(buffer[position]);
217 if(newstring[counter-1]!=
string[counter-1])
break;
221 newstring[counter]=
'\0';
222 if(strcmp(newstring,
string)==0){
231 if( position > bufferlength){
235 for(n=pos;n<position;n++){
239 while(iscntrl(buffer[n]) || isspace(buffer[n])){
257 if(destination==NULL || origin==NULL)
t_error(
"This file was not opened yet");
262 fprintf(destination,
"\n");
266 fprintf(destination,
"%c",ch);
272 printf(
"\nWarning::Empty file encountered");
290 len+=strlen(second)+2;
291 if(len >
FL)
t_error(
"Maximum directory length exceeded");
292 string=strcpy(
string,first);
293 string=strcat(
string,second);
307 len+=strlen(second)+2;
309 if(len >
FL)
t_error(
"Maximum directory length exceeded");
310 string=strcpy(
string,first);
311 string=strcat(
string,second);
312 string=strcat(
string,third);
325 printf(
"\nPRESS RETURN TO CONTINUE\n");
332 void time2date(
float time,
long *giulian,
long *year,
long *month,
long *day,
long *hour,
long *min,
float *sec)
342 long dmon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
356 giu=*giulian+floor((time+*hour*3600+*min*60+*sec)/(24*3600));
361 t=time-(dyear-*giulian+1)*24*3600;
387 t=t-((((giu-*giulian-1)*24+(23-*hour))*60+(59-*min))*60+(60-*sec));
389 *min=floor((t-*hour*3600)/60);
390 *sec=t-(*min+*hour*60)*60;
405 long dmon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
434 long dmon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
444 for(i=1;i<month;i++){
445 *giulian=*giulian+dmon[i];