I am trying to edit a file using CGI C outside of cgi-bin (~/workspace/files/html) and I tried opening the using this code (edited workspacename and user):
pfile = fopen("https://workspacename-user.c9users.io/files/html/output.html", "w");
I get an internal server error and when I checked the error logs it showed:
[Wed Oct 05 18:40:12.350766 2016] [cgi:error] [pid 28008] [client 10.240.0.213:54468] End of script output before headers: test.cgi, referer: https://workspacename-user.c9users.io/files/html/main.html
I tried changing the location of the file that I am trying to open to the cgi-bin directly:
pfile = fopen("output.html", "w");
and it seemed to work. Is there a way to solve this?
fopen()a URL in C (maybe you're used to PHP?). You need to give it a normal file system path.fopenaccepts paths that are valid on the file system at the point of execution". Please seefopen