Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're opening the file in read-only mode: <code>fopen("C:\\Users\\sshekha\\Desktop\\z.txt","r");</code>. Here <code>"r"</code> says you only intend to read from file. To be able to write contents (i.e. <code>fputs(...)</code>), open the file in write mode like so: fopen("C:\Users\sshekha\Desktop\z.txt","w")<code>(or</code>"a"` if you want to append). For more information, <a href="http://www.cplusplus.com/reference/cstdio/fopen/" rel="nofollow noreferrer">read fopen documentation</a>.</p> <p>EDIT: I see that you've tried both read and write modes. You're code only shows read-mode and hence my assumption on the read-only problem. Let me do a bit more research and get back.</p> <p>Please write the following code in your <code>if</code> statement:</p> <p><code>perror("The following error occurred:");</code></p> <p>if you don't have a console, use this to store the error string:</p> <p><code>char* errorCause = strerror(errno); MessageBoxA(m_hwndPreview, errorCause, "BTN WND", MB_ICONINFORMATION);</code></p> <p>and let us know what you see as the cause.</p> <p>EDIT 2: Since you've mentioned that you're using Visual Studio 2010, are you running it as yourself? This stackoverflow answer shows that VS2010 has different options when debugging applications; <a href="https://stackoverflow.com/a/3704942/210634">https://stackoverflow.com/a/3704942/210634</a></p> <p>NOTE: That feature is only available on 'Pro' versions.</p> <p>Here's a working example: <a href="https://ideone.com/hVLgc4" rel="nofollow noreferrer">https://ideone.com/hVLgc4</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload