Created
February 28, 2012 01:53
-
-
Save miyamuko/1928478 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; * src : fix ole-method. | |
;; ole-method で文字列を渡すと余計な 0x00 が付く問題 | |
;; via http://fixdap.com/p/xyzzy/8379/ | |
;; via http://d.hatena.ne.jp/miyamuko/20080304/xyzzy_ole_method_bug | |
;; | |
;; TODO: 多分これでいいんじゃないかと bowbow99 さんに回答する | |
(deftest fix-ole-method () | |
(flet ((ole-create-file (content) | |
(let ((tmp (make-temp-file-name))) | |
(unwind-protect | |
(let* ((fso (ole-create-object "Scripting.FileSystemObject")) | |
(file (ole-method fso 'OpenTextFile tmp 2))) | |
(unwind-protect | |
(ole-method file 'Write content) | |
(ole-method file 'Close)) | |
(file-length tmp)) | |
(delete-file tmp))))) | |
(values (ole-create-file "") | |
(ole-create-file "f") | |
(ole-create-file "foo"))) | |
=> 0 | |
=> 1 | |
=> 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment