First off im a total newbie when it comes to C++, but i was making a binary functions dll in C++ and well it only returns '0' back to me.
The program i use ONLY accepts double and null arguments to be passed back and forth through the dll, so i had to convert the file's binary data into 'double' but like i said i only get '0' in return...Code://Define export macro #define export extern "C" __declspec( dllexport ) //Headers #include <iostream> #include <fstream> #include <windows.h> using namespace std; ifstream::pos_type size; //Size of file char * memblock; //Memory "Storage" char * pEnd; //End char double ret; //Variable helps with conversion export double readFile(PCHAR filepath) { ifstream file (filepath, ios::in|ios::binary|ios::ate); if (file.is_open()) { size = file.tellg(); memblock = new char [size]; file.seekg (0, ios::beg); file.read (memblock, size); file.close(); ret = strtod(memblock,&pEnd); //Damnit! Now to convert :( return ret; //Return PLEASE! lol }else{ return 0; } }
So can anyone help with this? Im pretty sure its the dll thats causing the problem, but im not sure.
Thanks,
-Steve



LinkBack URL
About LinkBacks


