Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My guess is that whatever is running your program is doing so from a directory to which you don't have write permissions. The fact that there is no "garden.exe.stackdump" file gives that as a clue.</p> <p>When you save it to a file, are you saving it as <code>fopen("myfile","w")</code> or are you using a fully qualified name? For example, let's say that the file you want to save is called "foobar.png" and you want to save it to the directory you named below, you'd have something like:</p> <pre><code> char fname[256] = "foobar.png"; char directory[256] = "C:/Users/Joel/Desktop/garden/snaps"; char path[256]; memset(path, 0, sizeof(path)); strcpy(path, directory); strcat(path, "/"); strcat(path, fname); if ((fp = fopen(path, "w")) == NULL) { fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno)); exit(1); } fwrite(yourdata, yourdata_size, 1, fp); </code></pre> <p>Since your program also seems to dump errors to a file as well, you might do well to <code>chdir("/home/myname")</code> at the start of your program so that any ".stackdump" files get placed where you have access.</p> <p>The other thing you might want to take into account is that your task scheduler may be running your script as <code>nobody</code> or some other permissions-deprived account. If that's the case, you'll want to use a full path in <code>fopen</code> and <code>chdir</code> to a globally writable area (such as <code>/tmp</code>) or a working directory with open permissions. For example:</p> <pre><code>mkdir /home/myname/scratch chmod a+rwx /home/myname/scratch chmod a+x /home/myname </code></pre> <p>(You set the execute bit on your home directory so that the permission-less program can get access to its subdirectory even though it can't read anything in it.)</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