G
Gaspard, Bradley S
I want to open a file in python (version 2.2.3)
f = open("foobar.txt", "w")
and then pass the file's handle, f, to a "C" extention
EnumWinsatErrorCode SetOutStream(PyObject *fileObj)
{
FILE *fp;
if ((fp = PyFile_AsFile(fileObj)) == NULL) {
fprintf(stderr, "SetOutStream(): failed to obtain stream\n");
return WINSAT_SUP_TYPE_ERROR;
}
fprintf(fp, "This is a foobar\n"); // Causes windows application error
jglobal->debugout = fp;
return WINSAT_SUP_SUCCESS;
}
This works fine on my linux box. Under windows however I am getting fatal
error whenever I try and use the FILE * returned by PyFile_AsFile( ). Can
someone help me out??
f = open("foobar.txt", "w")
and then pass the file's handle, f, to a "C" extention
EnumWinsatErrorCode SetOutStream(PyObject *fileObj)
{
FILE *fp;
if ((fp = PyFile_AsFile(fileObj)) == NULL) {
fprintf(stderr, "SetOutStream(): failed to obtain stream\n");
return WINSAT_SUP_TYPE_ERROR;
}
fprintf(fp, "This is a foobar\n"); // Causes windows application error
jglobal->debugout = fp;
return WINSAT_SUP_SUCCESS;
}
This works fine on my linux box. Under windows however I am getting fatal
error whenever I try and use the FILE * returned by PyFile_AsFile( ). Can
someone help me out??