Assuming you are writing a Windows Store app and not a Win32 desktop application, the issue is that you don't have write access to the 'current working directory'. You need to specify a file location you have permission to write files to. You can confirm
this by looking at the actual return value that comes back from fopen_s. See
MSDN for a list of code meanings.
Also for Windows Store apps you should be using the Unicode version not the ASCII version of fopen_s.
For Windows Store apps use WinRT so to get a valid write location for your application you'd use:
WCHAR path[MAX_PATH];
auto folder = Windows::Storage::ApplicationData::Current->LocalFolder;
wcscpy_s( path, MAX_PATH, folder->Path->Data() );
wcscat_s( path, L"junk.txt" );
if (_wfopen_s( fout, path, L"w" ) == 0)
See
File access and permissions in Windows Store apps