I am using visual studio 2008, C++ MFC for window xp. I have a program that will create some files in my directory (like in C:/) which i created earlier and it will read/write data into the files. As the date is quite big, it take quite a while to write/read. So i would like to know is there anyway to prevent other from accessing to my files (go into C:/ and open it) when my program is running (writing or reading the files)? I am using fopen for file open and fscanf to read. Thanks alot.

In Windows, you can use LockFile() or LockFileEx() to lock portions / all of a file, but there are ways to still get read access to locked files.

Also, the extra overhead may not be worth it. Besides, 8 other processes opening up your data file to read it will really have no effect on the time it takes your process to read/write it. The HDD is slow. Deal with that. Windows will cache what it can/needs to.