[Mono-list] Simple code - differences in output between mono & .Net

Jonathan Stowe gellyfish@gellyfish.com
Thu, 04 Mar 2004 09:51:07 +0000


On Thu, 2004-03-04 at 09:39, Iain McCoy wrote:
> On Thu, 2004-03-04 at 03:13, Jonathan Stowe wrote:
> >           StreamReader mtab = new StreamReader("/etc/mtab");
> > 
> >           ArrayList stuff = new ArrayList();
> >           string[] fields;
> >           while ( (line = mtab.ReadLine()) != null )
> >           {
> >              fields = line.Split(new char[]{' '});
> >              if (fields[0] != "none")
> >              {
> >                 stuff.Add(fields[1]);
> >              }
> >           }
> What happens to /proc and /proc/bus/usb with this system?

They are explicitly skipped as a result of the 'fields[0] != "none"' -
if of course you wanted then in there then you could just remove that
condition.

As has been pointed out this is probably not vaery useful as a
GetLogicalDrives on a Unix-like system.  However it could be adapted to
(say) a GetMountedDrives() returning an array of MountedDrive structs -
this could be useful for writing 'df' or 'mount' or a disk management
tool in C#.

/J\