Equivalent of CreateFile in linux

I am writing a C++ program where i need to create a function similar to CreateFileW. The Function works only on windows and I want an equivalent of it in linux. I need this new function which is compatible with linux to pass wchar_t in it. How can I do that?

Could you explain what exactly you need to know, and for which language?

A Windows-specific function name isn’t telling someone like me who works pretty much exclusively with Linux what you need. :wink:

@airtower-luna You can see the edits

The edited version still says you need an equivalent to a Windows function, without explaining what that function does, or what goal you’re trying to achieve (e.g. “write text to a file”, or something). :sweat_smile:

CreateFileW is the function used to create a file where the filename contains Unicode characters.

The C++ runtime functions such as fopen will accept any stream of bytes as the filename. These functions are locale-agnostic.

To get your desired UTF-8 characters in the filename, it may be necessary to call setlocale() with your target locale.

1 Like