I am creating a named pipe connection between a .NET C# server app and a Win32 client app. In .NET C# it is possible to create a System.IO.StreamReader
object from named pipe server/client stream. Is anything similar available in Winapi to read from named pipe line by line??
Named pipes are special files, as such you read from them using the file IO API, namely ReadFile
, etc.
The MSDN has a complete example for opening and reading from a named pipe.
The issue with
ReadFile
is that it requires to specify size of buffer which isn't constant in my use hence I am looking for another solution.@SoumyaMahunt That’s simply how low level file IO (which is what the WinAPI provides) works. It always works like this. If you wan that, you’ll have to manage a dynamic buffer yourself, by reading fixed-sized chunks, determining the correct length and appending to a dynamically growing buffer.