Here's my main function, the problem lies almost in the first line where I delcare an instance of DynamicString on heap.
If you need more code, just let me know:
The error is this:Code:#include <fstream> // This is required for file streams. #include <iostream> #include "email.h"// This is required for input/output streams. (ie cout) using namespace std; int main() { ifstream emailFile( "Email.txt" ); // Open a file for inputing. ofstream fout( "EmailResponse-rjg5021.txt" ); while( !emailFile.eof() ) { DynamicString s = new DynamicString( ); emailFile.getline( s.Buffer, 1000 ); Email anEmail( s.Buffer ); if( anEmail.IsValid() ) { //std:: cout << 1 << std::endl; fout << 1 << endl; } else { //std:: cout << 0 << std::endl; fout << 0 << endl; } s.~DynamicString(); } emailFile.close(); // All done so close the file. return 0; }
error C2440: 'initializing' : cannot convert from 'DynamicString *' to 'DynamicString'
No constructor could take the source type, or constructor overload resolution was ambiguous
but the constructor is:
Code:DynamicString() { Size = 0; Buffer = NULL; }
I've tried using the another constructor, but to no avail:
Code:DynamicString(const char* buffer, int bufferSize = 0) { // Size not speciied? if ( bufferSize == 0 ) // Figure it out by searching for the end of string bufferSize = GetStringLength(buffer); Size = bufferSize; Buffer = new char[Size]; // Copy buffer Copy(buffer, Buffer, 0, bufferSize); }
Any ideas?



LinkBack URL
About LinkBacks


