I upgraded from pike v7.4.44 to 7.6.24 and now I can no longer write to files using the same code I used from before. Instead I get an error stating:
Bad argument 1 to file->write(). Type is int. Expected string or array(string) _static_modules.files()->Fd: Fd(1)->write(0)
Below is the code I am using to do so:
void CompileError ( string file, int line, string err ) { string sFile; object ferr = Stdio.File("C:/EMAGE/sys/data/log/comp.c", "wca+"); sscanf(file, "C:/EMAGE%s", sFile); string sOut = sFile + ": " + (string)line + "-" + err + "\t" + ctime(time()); ferr->write("%s:%s:%s\t%s\n", sFile, line?(string)line:"-",err, ctime(time())); ferr->close(); }
I have tried several variations of this to no avail. Including:
if(stringp(sOut)) { object o = Stdio.File(); if(o) { if(o->open("C:/EMAGE/sys/data/log/comp.c", "wca", 0777)) { if(o->write(sOut)) { return; } } } }
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com