techo_unicode.nim 738 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. discard """
  2. output: '''ÄhmÖÜ
  3. abasdfdsmÄhmaИ
  4. Иnastystring
  5. A你好
  6. ИnastystringA你好
  7. ÖÜhmabasdfdsmÄhmaИOK'''
  8. disabled: "posix"
  9. joinable: "false"
  10. """
  11. import winlean
  12. echo "ÄhmÖÜ"
  13. echo "abasdfdsmÄhmaИ"
  14. echo "Иnastystring"
  15. echo "A你好"
  16. write stdout, "Иnastystring"
  17. writeLine stdout, "A你好"
  18. stdout.flushFile()
  19. let handle = getOsFileHandle(stdout)
  20. var a = "ÖÜhmabasdfdsmÄhmaИ"
  21. var ac = 0'i32
  22. discard writeFile(handle, addr a[0], int32(len(a)), addr ac, nil)
  23. stdout.flushFile()
  24. import os
  25. let str = "some nulls: \0\0\0 (three of them)"
  26. let fpath = getTempDir() / "file_with_nulls.bin"
  27. writeFile(fpath, str)
  28. doAssert(getFileSize(fpath) == 31)
  29. doAssert(readFile(fpath) == str)
  30. removeFile(fpath)
  31. echo "OK"