My readstream result is different to yours.
the first 18 values are the same, after is different.
yours is 5792 characters
Mine is 7003 characters
Yours writes 16 characters.
Mine writes 7003 characters.
Try this :
(setq SlideText (vl-string->list (_readstream "D:\\bsph.sld" t)))
(_writestream "D:\\new.sld" (vl-list->string SlideText) "w")
(command "._VSLIDE" "D:\\new.sld")
and reload the functions
;;; CodeHimBelonga MP fromTheSwamp
(defun _ReadStream ( path len / fso file stream result )
;; If the file is successful read the data is returned as
;; a string. Won't be tripped up by nulls, control chars
;; including ctrl z (eof marker). Pretty fast (feel free
;; to bench mark / compare to alternates).
;;
;; If the caller wants the result as a list of byte values
;; simply use vl-string->list on the result:
;;
;; (setq bytes
;; (if (setq stream (_ReadStream path len))
;; (vl-string->list stream)
;; )
;; )
;;
;; Arguments:
;;
;; path <duh>
;; len Number of bytes to read. If non numeric, less
;; than 1 or greater than the number of bytes in
;; the file everything is returned.
(vl-catch-all-apply
'(lambda ( / iomode format size )
(setq
iomode 1 ;; 1 = read, 2 = write, 8 = append
format 0 ;; 0 = ascii, -1 = unicode, -2 = system default
fso (vlax-create-object "Scripting.FileSystemObject")
file (vlax-invoke fso 'GetFile path)
stream (vlax-invoke fso 'OpenTextFile path iomode format)
size (vlax-get file 'Size)
len (if (and (numberp len) (< 0 len size)) (fix len) size)
result (vlax-invoke stream 'read len)
)
(vlax-invoke stream 'Close)
)
)
(if stream (vlax-release-object stream))
(if file (vlax-release-object file))
(if fso (vlax-release-object fso))
result
)
;;; CodeHimBelonga MP fromTheSwamp
(defun _WriteStream ( path text mode / fso stream file result )
;; Return the file size if the file is successfully written
;; to, otherwise nil. Will write all ascii chars to file
;; including nulls. If the caller wants to pass a list of
;; byte values to the function just call it like so:
;;
;; (_WriteStream
;; path
;; (vl-list->string '(87 111 111 116 33))
;; mode
;; )
;;
;; Arguments:
;;
;; path <duh>
;; text <duh>
;; mode "a" to create/append,
;; "w" to create/overwrite (default)
(setq mode (if (member mode '("a" "A")) "a" "w"))
(vl-catch-all-apply
'(lambda ( / format )
(setq fso (vlax-create-object "Scripting.FileSystemObject"))
(cond
( (or (null (findfile path)) (eq "w" mode))
(setq stream
(vlax-invoke
fso
'CreateTextFile
path
-1 ;; 0 (false) = don't overwrite , -1 (true) = overwrite
0 ;; 0 (false) = ascii, -1 (true) = unicode
)
)
(setq file (vlax-invoke fso 'GetFile path))
)
( (setq file (vlax-invoke fso 'GetFile path))
(setq stream
(vlax-invoke
file
'OpenAsTextStream
8 ;; 1 = read, 2 = write, 8 = append
0 ;; 0 = ascii, -1 = unicode, -2 system default
)
)
)
)
(vlax-invoke stream 'Write text)
(vlax-invoke stream 'Close)
(setq result (vlax-get file 'Size))
)
)
(if file (vlax-release-object file))
(if stream (vlax-release-object stream))
(if fso (vlax-release-object fso))
result
)