about summary refs log tree commit diff stats
path: root/cxdrt.lisp
diff options
context:
space:
mode:
authorDarren Bane <darren.bane@gmail.com>2020-08-30 15:32:05 +0100
committerDarren Bane <darren.bane@gmail.com>2020-08-30 15:32:05 +0100
commit4e68c5a3613c8fad09a3bb155222f9d0bd1209e1 (patch)
treeb6b6f57f10b2a0e1c95a4212db1d2ca98de4774b /cxdrt.lisp
parentd737f1ab887c1d3e7b97cfaa443e6037d5f53c5b (diff)
downloadlsp-4e68c5a3613c8fad09a3bb155222f9d0bd1209e1.tar.gz
Making changes
Diffstat (limited to 'cxdrt.lisp')
-rw-r--r--cxdrt.lisp18
1 files changed, 18 insertions, 0 deletions
diff --git a/cxdrt.lisp b/cxdrt.lisp
new file mode 100644
index 0000000..6c84657
--- /dev/null
+++ b/cxdrt.lisp
@@ -0,0 +1,18 @@
+(defun xwrt (fname)
+  (with-open-file (f fname :direction :output :if-exists :supersede :element-type '(unsigned-byte 8))
+    (frpc:write-xtype :int32 f 1234)
+    (frpc:write-xtype :real32 f 3.14159)
+    (frpc:write-xtype :real64 f 2.71828d0)
+    (frpc:write-xtype :int32 f -5678)
+    (frpc:write-xtype :string f "XDR and Common Lisp")
+    (frpc:write-xtype :int32 f 21845)))
+
+(defun xrdr (fname)
+  (with-open-file (f fname :direction :input :element-type '(unsigned-byte 8))
+    (format *standard-output* "~A ~A ~A ~A ~A~%~A~%"
+            (frpc:read-xtype :int32 f)
+            (frpc:read-xtype :real32 f)
+            (frpc:read-xtype :real64 f)
+            (frpc:read-xtype :int32 f)
+            (frpc:read-xtype :string f)
+            (frpc:read-xtype :int32 f))))