Have you tried this now?

First try again with pure C code and compile with a C compiler, not
with C++ code and C++ compiler.
 Then, tweak the code to use more buffering, to make it more similar
to readline code, like this (not tested):

#include <stdio.h>
#include <time.h>

char vs[1002000][100];
char buffer[65536];

int main(void) {
    FILE *fp;
    int i, m;
    clock_t begin, end;
    double t;

    begin = clock();
    fp = fopen("cvspython.txt", "r");
    i = 0;
    setvbuf(fp, buffer, _IOFBF, sizeof(buffer));
    while(1) {
        if(!fgets(vs[i], 100, fp)) break;
        ++i;
    }
    fclose(fp);
    printf("%d\n", i);
    end = clock();
    t = (double)(end - begin)/CLOCKS_PER_SEC;
    printf("%g\n", t);

    scanf("%d", &m);
    printf("%s\n", vs[m]);
    getchar();
    return 0;
}

 Finally, repeat your statement again, if necessary.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to