Open and Read functions - Linux

This is a discussion on Open and Read functions - Linux ; Hi there, In an old post, I asked what the equivalents of the CreateFile/ReadFile functions of the kernel32 library. Can we use an equivalent of the kernel32 library in MONO/Linux? Is anybody has an idea? The goal is to send ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: Open and Read functions

  1. Open and Read functions

    Hi there,

    In an old post, I asked what the equivalents of the CreateFile/ReadFile
    functions of the kernel32 library. Can we use an equivalent of the
    kernel32 library in MONO/Linux?

    Is anybody has an idea?
    The goal is to send bytes to the COM port (RS232) and receive data...

    Thanks a lot
    Vincent


  2. Re: Open and Read functions

    Vins wrote:
    >
    > Hi there,
    >
    > In an old post, I asked what the equivalents of the CreateFile/ReadFile
    > functions of the kernel32 library. Can we use an equivalent of the
    > kernel32 library in MONO/Linux?


    The POSIX standard (which microsoft mostly chooses to ignore) specifies
    the open/read/write/close functions.

    > Is anybody has an idea?
    > The goal is to send bytes to the COM port (RS232) and receive data...


    You need open/read/write/close.

    Erik
    --
    +-----------------------------------------------------------+
    Erik de Castro Lopo
    +-----------------------------------------------------------+
    "The RIAA is obsessed to the point of comedy with the frustration
    of having its rules broken, without considering whether such rules
    might be standing in the way of increased revenues. Indeed,
    Napster and Gnutella may turn out to be the two best music-marketing
    gimmicks yet devised, if only the RIAA would take its head out of
    its ass long enough to realise it."
    -- Thomas C Greene on www.theregister.co.uk

  3. Re: Open and Read functions

    Ok but how do you use these functions with MONO?


  4. Re: Open and Read functions

    On 2006-10-13, Erik de Castro Lopo wrote:
    > Vins wrote:
    >>
    >> Hi there,
    >>
    >> In an old post, I asked what the equivalents of the CreateFile/ReadFile
    >> functions of the kernel32 library. Can we use an equivalent of the
    >> kernel32 library in MONO/Linux?

    >
    > The POSIX standard (which microsoft mostly chooses to ignore) specifies
    > the open/read/write/close functions.
    >
    >> Is anybody has an idea?
    >> The goal is to send bytes to the COM port (RS232) and receive data...

    >
    > You need open/read/write/close.


    Along with the get/set termios calls.

    --
    Grant Edwards grante Yow! We have DIFFERENT
    at amounts of HAIR --
    visi.com

  5. Re: Open and Read functions


    Vins wrote:

    > In an old post, I asked what the equivalents of the CreateFile/ReadFile
    > functions of the kernel32 library. Can we use an equivalent of the
    > kernel32 library in MONO/Linux?


    You should ask someplace where you can find people who know something
    about MONO. This newsgroup is about Linux system development.

    > Is anybody has an idea?
    > The goal is to send bytes to the COM port (RS232) and receive data...


    If MONO has some special way to do this, or supports using
    CreateFile/ReadFile to do that, then use it. Otherwise, do it the
    normal UNIX way.

    DS


  6. Re: Open and Read functions

    Vins wrote:
    > Hi there,
    >
    > In an old post, I asked what the equivalents of the CreateFile/ReadFile
    > functions of the kernel32 library. Can we use an equivalent of the
    > kernel32 library in MONO/Linux?


    There is a project for cloning Windows DLL's under Linux. My guess
    would be that calling Win32 functions from Mono is done by using the
    clones of these libraries from Winelib. A cursory Google search seems
    to confirm this.

    Unless your application is substantially tied to many Win32 interfaces,
    you're probably better off porting it to POSIX, rather than dragging in
    a dependency on these libraries. Create some classes which abstract the
    platform; i.e. can be implemented using the Win32 functions on Windows,
    and using POSIX functions on Linux.

    > Is anybody has an idea?
    > The goal is to send bytes to the COM port (RS232) and receive data...


    On Linux, this is done using open() to open the device, tcsetattr() and
    tcgetattr() to set up the serial communication parameters, read() and
    write() to perform data transfers. This the ``native'' way of doing
    serial stuff with the Linux kernel.

    If your program is a deamon, be sure to use the O_NOCTTY flag when
    opening the device, so that it doesn't become its controlling terminal.


  7. Re: Open and Read functions

    My goal is to use equivalent functions of CreateFile/ReadFile with C#
    in MONO/linux...can anyone help me?


  8. Re: Open and Read functions

    "Vins" wrote:
    >
    >My goal is to use equivalent functions of CreateFile/ReadFile with C#
    >in MONO/linux...can anyone help me?


    There are a billion C# tutorials on the web. Really -- Google is your
    friend.

    using System.IO;
    ....
    {
    StreamReader sr = new StreamReader("TestFile.txt");
    string line;
    while( (line = sr.ReadLine()) != null )
    {
    Console.WriteLine( line );
    }
    }
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

  9. Re: Open and Read functions

    The goal is not to create a file or something like that it s to use the
    functions of the namespace System.IO.Ports.SerialPort


  10. Re: Open and Read functions

    Vins wrote:
    > My goal is to use equivalent functions of CreateFile/ReadFile with C#
    > in MONO/linux...can anyone help me?


    No, your goal appears to be to have someone change your diaper and burp
    you.


  11. Re: Open and Read functions

    "Vins" wrote:
    >
    >The goal is not to create a file or something like that it s to use the
    >functions of the namespace System.IO.Ports.SerialPort


    30 seconds with Google led me directly to a web page demonstrating the use
    of System.IO.Ports.SerialPort in Mono.

    Seriously, Google is MUCH more efficient than waiting for a response from a
    newsgroup.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

+ Reply to Thread