realbasic-nug
[Top] [All Lists]

Re: Reading special Unix files in RB, like /dev/random

To: realbasic-nug at lists dot realsoftware dot com
Subject: Re: Reading special Unix files in RB, like /dev/random
From: "Theodore H. Smith" <delete at elfdata dot com>
Date: Mon, 28 Apr 2008 19:18:47 +0100
Authentication-results: mx.google.com; spf=pass (google.com: domain of realbasic-nug-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug-bounces at lists dot realsoftware dot com
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <mailman dot 3300 dot 1209404276 dot 24661 dot realbasic-nug at lists dot realsoftware dot com>
> From: Norman Palardy <npalardy at great-white-software dot com>
> To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>

>> Can RB read special unix files? Like /dev/random
>>
>> Did anyone ever have a need to do this?
>>
>> Just wondering...
>>
>> for what it's worth, you can read special unix files in RB
>> nowadays,  using my ElfData plugin.
>
> Yes you can
> Charles documented it in Chapter 12 of his book some time ago
>
> However, a quick test using a folderitem in RB code does not seem to
> be able to get access to /dev/random or /dev/urandom
>
>   dim f as folderItem
>
>   f = GetFolderItem("/dev/urandom", FolderItem.PathTypeShell)
>
>   if f is nil then
>     msgbox "f is nil"
>     return
>   end if
>
>   dim ts as TextInputStream = f.OpenAsTextFile
>
>   dim s as string = ts.ReadLine
>
>   break

dim f as ElfDataFile
f = "/dev/random"
msgbox f.Data(1024).Hex // reads in 1024 bytes and hexes them.

Well this works perfectly. Basically, ElfData reads special Unix files  
just fine.

Also, I don't think reading /dev/random line by line makes much sense.  
Because... it's a binary file. A line could be infinitely long :) if  
you were infinitely unlucky enough.

--
http://elfdata.com/plugin/
"String processing, done right"


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>