i am trying to work with sockets for the first time.
i need a function that reads exactly
how can i do this?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
;; bgra -> rgba
(define (swaprb32 data)
(join (map (lambda (x) (select x 2 1 0 3)) (explode data 4)) ""))
;; bgr -> rgb
(define (swaprb24 data)
(join (map reverse (explode data 3)) ""))
;; testing
(print "test-rgba: ")
(set 'testdata (dup "bgra" (* 512 512))) ; data from file
(set 'testres (dup "rgba" (* 512 512))) ; what i want to get
(print (time (set 'res (swaprb32 testdata))) " ")
(println (= res testres))
(print "test-rgb: ")
(set 'testdata (dup "bgr" (* 512 512)))
(set 'testres (dup "rgb" (* 512 512)))
(print (time (set 'res (swaprb24 testdata))) " ")
(println (= res testres))
> (set 'f (open "storage.tmp" "r"))
3
> (seek f)
0
> (seek f -1)
nil
> (seek f 5893610690)
1598643394
(open "newlisp_manual.html" "read")
(seek file -1) ; seek to EOF
→ 593816
(set 'fle (open "large-file" "read")
(seek file 30000000000) → 30000000000
newLISP supports file position numbers up to 9,223,372,036,854,775,807.