Python typemap for FILE* (in behalf of Marcelo)

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5929 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Luigi Ballabio 2004-05-26 12:44:38 +00:00
commit 95a6fa8edb
5 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,28 @@
%module file_test
%include file.i
%inline
%{
int nfile(FILE *file) {
printf("hello %p\n", (void*)file);
if (file) {
// fprintf(file,"hello\n");
}
return 0;
}
int nfile(const char *filename) {
FILE *file = fopen(filename,"w");
nfile(file);
fclose(file);
return 0;
}
FILE* GetStdOut() {
return stdout;
}
%}

View file

@ -14,6 +14,7 @@ CPP_TEST_CASES += \
attributetest \
complextest \
director_stl \
file_test \
implicittest \
inplaceadd \
lib_std_vectora \

View file

@ -0,0 +1,9 @@
import sys
import file_test
file_test.nfile(sys.stdout)
cstdout = file_test.GetStdOut()
file_test.nfile(cstdout)
file_test.nfile("test.dat")