Final fixup of dprintf tests.

This commit is contained in:
Ernie Pasveer
2024-12-21 09:17:01 -06:00
parent e55cb1db96
commit 9e4156ab11
3 changed files with 4 additions and 34 deletions
-33
View File
@@ -4,37 +4,8 @@
#include <stdio.h>
#include <stdarg.h>
FILE* logfile = NULL;
extern "C" {
int log_msg (const char* format, ...) {
int n;
va_list args;
// init the variable length argument list
va_start(args, format);
n = vfprintf(logfile, format, args);
// cleanup the variable length argument list
va_end(args);
return n;
}
}
extern "C" {
void fortranfunction_ (int* count);
}
int main (int argc, char** argv) {
const char* filename = "logfile.txt";
logfile = fopen(filename, "w");
if (logfile == NULL) {
fprintf(stderr, "Failed to open logfile: %s\n", filename);
return 1;
}
int count = 10;
int nfact = 1;
int n;
@@ -46,10 +17,6 @@ int main (int argc, char** argv) {
std::cout << std::setw(12) << n << std::setw(14) << nfact << std::endl;
}
fortranfunction_(&count);
fclose(logfile);
return 0;
}