PUBLIC ssize mprWriteFileFmt(MprFile *file, cchar *fmt, ...) { va_list ap; char *buf; ssize rc; rc = -1; va_start(ap, fmt); if ((buf = sfmtv(fmt, ap)) != NULL) { rc = mprWriteFileString(file, buf); } va_end(ap); return rc; }
static void testCopyPath(MprTestGroup *gp) { MprFile *file; char *from, *to; from = sfmt("copyTest-%s.tmp", mprGetCurrentThreadName(gp)); assert(from != 0); file = mprOpenFile(from, O_CREAT | O_TRUNC | O_WRONLY, 0664); assert(file != 0); mprWriteFileString(file, "Hello World"); mprCloseFile(file); to = sfmt("newTest-%s.tmp", mprGetCurrentThreadName(gp)); assert(mprPathExists(from, F_OK)); mprCopyPath(from, to, 0664); assert(mprPathExists(to, F_OK)); mprDeletePath(from); mprDeletePath(to); }