Accessing simple text files across the network

Hi all,

I’m writing some software in C++ to very simply access and update some text files saved onto the My Home Cloud across the network from my Laptop. The My Home Cloud is connected directly to the BT Router Hub.

WDMyCloud has simple text files under the Family folder which I need to access in a C++ Windows executable Program written using MFC and Visual Studio 2017

The PC is logged on and the WDMycloud is mapped by the WD application as drive Z:

I know that it will not be possible to open these files using the local mapped drive letter so instead I use WNetGetConnection() to extract the Remote name (UNC)

I then append the rest of the path to the actual file to the UNC Remote name to access the files I need and attempt to open the file the normal way.

CFile Input;
CFileException FileError ;
Input.Open (csValidUNCPathAndFilename, CFile::modeRead | CFile::typeText
| CFile::shareDenyNone, &FileError);

This fails to open the file and FileError::GetErrorMessage says “filepath Not Found” although it is valid and present.

I cannot understand why (the same code works fine on a local drive)

Any advice/explanation greatly appreciated.

You’d better ask this on stackexchange…
Anyway, did you try this? c++ - fopen file from windows network location - Stack Overflow
First learn to write to a samba share.
Then try it on the MCH.