I am using ubuntu linux and i am just a beginner is c language i have created a program that creates a lock file when started inside a folder but both the file and folder are with [DOT] like .folder and .file and linux hides such files and folders and i have another program that checks if the file exists or not if it exists then the program is running and if it doesn't then its not simple here is my code

```
FILE* lockfile = fopen("/.folder/.lock", "r");
if (!lockfile) {
    printf("Cannot find lock file");
} else {
    printf("lock file found");
}

```

the folder is in the root directory and i just wanna read the file so i gave "r" as the access i made a lot of search but only found answers to windows based programs can anyone point out where am i wrong or any solution for it?
how can i read hidden files and folders in linux through c?

EDIT: added images to make things a bit more clear

[![folder](https://i.stack.imgur.com/6wqkc.png)](https://i.stack.imgur.com/6wqkc.png)

The `.folder` directory it has all the permission for the current user

[![file](https://i.stack.imgur.com/ogRO5.png)](https://i.stack.imgur.com/ogRO5.png)

The `.lock` file also has the read permission for the current user so i don't think there is a problem with the permission or i am still wrong?