Hi guys,
i'm having some troubles finishing my programm. My programm delete all files that have the same parameter.
So here i read the files and find a specific string:
Code:if (datei = fopen(filepfad, "a+")) { while (fgets(buffer, sizeof(buffer), datei)){ vtNr = 0; index = 0; str_leng = my_strlen(buffer); //So lange das der Teil String "vtNr" nicht gefunden wird, springt der buffer an die nächste Stelle. //Wenn die letzte Stelle der Zeile erreicht wurde springt das Programm in die nächste Zeile.(Dokumentaiton zu fgets lesen) while(!( buffer[index] == 'v' && buffer[index + 1] == 't' && buffer[index + 2] == 'N' && buffer[index + 3] == 'r') && index <= (str_leng - 3) )index++; if ( index < str_leng - 3 ) { while(!(buffer[index] >= '0' && buffer[index] <= '9'))index++; while(buffer[index] >= '0' && buffer[index] <= '9') { vtNr = vtNr * 10 + chartoint(buffer[index]); index++; } fclose(datei); if ( vtNr > 999999) vtNr_vergleichen(vtNr, filepfad); } }
In the while loop i check if the string is found, but i want that the user determined which string he is looking for. I thought do to it like something like this:
str_end is the length of the string written by the user.Code:while( !( for(i=0 ; i < str_end ; i++) buffer[index + i] == str_looking [i]) ) index++;
Thanks for your time.



LinkBack URL
About LinkBacks
. 


