output file in current directory

This commit is contained in:
tTh 2023-04-22 18:41:34 +02:00
parent 1ff0230d15
commit 50d83a6ce2

View File

@ -11,6 +11,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <libgen.h> /* for basename(3) */
#include "../bubulles.h" #include "../bubulles.h"
#include "../edges.h" #include "../edges.h"
@ -179,7 +180,7 @@ float x, y, z;
int foo, tokenid; int foo, tokenid;
Bubulle bubulle; Bubulle bubulle;
char *outfname; char *outfname, *baseptr;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' ... %d )\n\n", __func__, infname, notused); fprintf(stderr, ">>> %s ( '%s' ... %d )\n\n", __func__, infname, notused);
@ -327,10 +328,13 @@ if (outstyle) { /* two ascii files */
} }
else { /* one 'evblob' file */ else { /* one 'evblob' file */
strcpy(outfname, infname); strcpy(outfname, infname);
cptr = rindex(outfname, '.'); /* see manpage basename(3) */
baseptr = basename(outfname);
// fprintf(stderr, "baseptr -> [%s]\n", baseptr);
cptr = rindex(baseptr, '.');
strcpy(cptr, ".evblob"); strcpy(cptr, ".evblob");
fprintf(stderr, "outfname [%s]\n", outfname); // fprintf(stderr, "baseptr-> [%s]\n", baseptr);
foo = x_write_vertedges(outfname, bublist, edges); foo = x_write_vertedges(baseptr, bublist, edges);
if (foo) { if (foo) {
fprintf(stderr, "Err #%d when writing edges&vertices file\n", foo); fprintf(stderr, "Err #%d when writing edges&vertices file\n", foo);
} }