简体   繁体   中英

How do you open a file for shared writing in C?

I only found how to do it in C++ which is somthing like CreateFile(.... FILE_SHARE_READ | FILE_SHARE_WRITE, ....) but found nothing on how to do it in C.

What you are asking for is not possible in plain ISO C, which only offers the function fopen .

However, on Microsoft Windows, you can call the platform-specific function CreateFile , which offers this feature as an extension. You can use this function also when using the C programming language. It is not restricted to C++. The Microsoft documentation of the Windows API does not distinguish between C and C++, so when it refers to C++, it also means C.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM