问题描述:

I want to write to a text file through a dll, it compiles fine but it doesn't output the file with following code. When I compile the project to a .exe and run it, it can creat the file and write to the file.

What do I need to do to write from the dll??

I want to output some data inside the dll for debugging purpose, instead of return these intermediate data from the dll. I'm calling the dll from python/

credit.cpp

#include <stdlib.h>

#include <iostream>

#include <fstream>

using namespace std;

double* _stdcall credit(double* in_array, double a, double b)

{

ofstream myfile;

myfile.open("example.txt");

myfile << "Hi!\n";

myfile.close();

return in_array;

}

credit.def

LIBRARY "pass"

;DESCRIPTION 'call dll from python'

EXPORTS

credit

credit.h

#pragma once

double* __stdcall credit(double a, double b, double *in_array);

相关阅读:
Top