|
-
February 6th, 2007, 09:52 PM
#1
need help to passing string in function
I am trying to pass a string called fildir in a function closeFile(filedir)
I have provided the header file and cpp file. I am new to classes I need some help passing a string
-----------------------------------------------------------------------------
header file
#include <string>
using std::string;
/////////////////////////////////////////////////////////////////////////////
// CStrengthCoachDlg dialog
class CStrengthCoachDlg : public CDialog
{
// Construction
public:
CStrengthCoachDlg(CWnd* pParent = NULL); // standard constructor
//void closeFile(char tempFilename[255]); //fm
void closeFile(string* filedir);
-----------------------------------------------------------------------
.cpp file
//void CStrengthCoachDlg::closeFile(char tempFilename[]) //close out file
void CStrengthCoachDlg::closeFile(string& filedir) //close out file
{
ofstream out_stream;
out_stream.close();
string systemcall = "START " + filedir;
system(systemcall.c_str());
return;
}
----------------------------------------------------------
compile errors:
Compiling...
StrengthCoachDlg.cpp
C:\Documents and Settings\fm\Desktop\Working_beta\Copy (2) of beta_strengthcoach_a\StrengthCoachDlg.cpp(776) : error C2664: 'closeFile' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocato
r<char> >' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
C:\Documents and Settings\fm\Desktop\Working_beta\Copy (2) of beta_strengthcoach_a\StrengthCoachDlg.cpp(4677) : error C2511: 'closeFile' : overloaded member function 'void (class std::basic_string<char,struct std::char_traits<char>,class std::alloca
tor<char> > &)' not found in 'CStrengthCoachDlg'
c:\documents and settings\fm\desktop\working_beta\copy (2) of beta_strengthcoach_a\strengthcoachdlg.h(17) : see declaration of 'CStrengthCoachDlg'
Error executing cl.exe.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|