output file in current directory

This commit is contained in:
tTh 2023-04-22 18:41:34 +02:00
parent 1ff0230d15
commit 50d83a6ce2
1 changed files with 8 additions and 4 deletions

View File

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