The code successfully creates a file for me in OnlineGDB.
However, please remember that your local Windows and the Linux (of OnlineGDB) operating systems and the C language on them may work slightly differently.
Please note, that you're missing a '\' from your path. Your path should correctly be: "C:\\test\\Myprogram.txt".
If that still does not allow your code to work, make sure that the C:\test directory exists as fopen() does not create the directory hierarchy for you.
Good luck!