# Opening a character device in driver



## j4ck (Jun 18, 2016)

Is it possible to open character device in a driver and write on it? Something like:


```
int open_port()
{
    int fd;
    char portopen[1000];
    sprintf(portopen, "echo");
    fd = open(portopen, O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);

    return (fd);
}
```
I suppose this can be done in a user-space application only. Am I right?


----------

