my own type, print function

Torsten Mohr tmohr at
Thu Sep 9 21:12:45 CEST 2004


i have created an own type in C and have implemented
the print function for it.

static int mytype_print(mytype_obj* self, FILE* fp, int flags) {
        printf("[%p]", fp);
        fprintf(fp, "Hello, world\n");

At the moment i ignore "flags".  The first line "printf" is
executed, fp is NOT Null.  But i haven't yet explored the memory
at that location.  At the moment it points to 7803BB68.

The second line "fprintf" crashes the program.
The command at 0x77f88216 points to 0x00000010.  The action
"written" could not be executed.  (I translated that from german).

If i delete the second line, the program runs normally,
as i'd expect it.

Can anybody give me a hint what could be wrong here?

Best regards,

More information about the Python-list mailing list