Dear Gustaf, I absolutely agree with you.
The changes you proposed in your last post are allmost perfect. I had to change them as follows:
int i;
char *buf = _tempnam("/tmp", "nsd");
if (buf == NULL) {
Tcl_SetResult(interp, "could not generate temporary filename.", TCL_STATIC);
return TCL_ERROR;
}
/*
Change back slash characters into slash characters
*/
for (i = 0; i < strlen(buf); i++) {
if (buf[i] == '\\') buf[i] = '/';
}
/*
The documentation says that _tempnam() allocates memory via
malloc(); to be sure, that the "right" free() is used, we do
not use TCL_DYNAMIC but the TCL_VOLATILE followed by the manual
free().
*/
Tcl_SetResult(interp, buf, TCL_VOLATILE);
free(buf);
The problem is that _tempname generates file names in the Windows style (i.e. with back slash characters) and SqlLdr doesn't like that style for the "control" parameter (it requires normal slash characters).
Once again many thanks,
Maurizio