Thank you guys!
quzah:
Actually the right codeline is
Code:
strcpy(hst[c], strchr(hst[c],9)+1);
When I transfered the code to here I made some adapts and I changed it with no intention. sorry.
Cshot:
Sorry you too. the line you adapted
Code:
strcpy(hst[i], strchr(currLine, '\t')+1);
is the same of mine:
Code:
strcpy(hst[c], strchr(hst[c], 9)+1);
the error is in this line.
Anyway your code is better than mine. Also you implemented maloc().
Well I implemented a function to sweep the lines stored into memory and show me the repeated entries:
Code:
void repeated()
{
int a, c, repetidos = 0;
for (a = 0; a < lines; a++)
{
for (c = a + 1; c < lines; c++)
{
if (strcmp(m[a],m[c]))
{
repetidos++;
printf("\nrepeted: %d : %d",a + 1,c + 1);
}
}
}
printf("\nrepeated: %d", repetidos);
}
Believe me: this function took 6 mins to be processed at pentium3 1Ghz. As I said its about 58,735 lines (biggest lenght line: 80).
Note that I used this function with the complete line:
bla-bla...bla [TAB] text_I_want
I have a VB3 program that do the same work with the same file (1.6Mb) in less than 30 seconds. How do I improve this time in my code?
And about that:
Code:
strcpy(hst[c], strchr(hst[c], 9)+1);
Thank you guys