Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. %module example
  2.  
  3. %{
  4. #define SWIG_FILE_WITH_INIT
  5. #include <iostream>
  6.  
  7. void stdin_to_file()
  8. {
  9. char buf[10];
  10. fscanf(stdin, "%s", buf);
  11. FILE *f = fopen("stdin.txt", "w");
  12. fprintf(f, "%s", buf);
  13. fclose(f);
  14. }
  15.  
  16. void str_to_stdout()
  17. {
  18. char buf[] = "foobar";
  19. fprintf(stdout, "%s", buf);
  20. }
  21.  
  22. %}
  23.  
  24. %include <std_iostream.i>
  25. void stdin_to_file();
  26. void str_to_stdout();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement