|
-
Oct 4th, 2000, 01:50 PM
#1
Thread Starter
Frenzied Member
I am using this simple routine to copy a file.I use MFC(e1 is a variable for the EDIT control of type CString).I get a error because the compiler can not convert from string to CString.How to solve this?
Code:
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
string got,all;;
ifstream in("readme.txt");
ofstream out("copy.txt");
while(getline(in,got))
out<<got<<"\n";
all += got;
e1 =all;
UpdateData(false);
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable
-
Oct 4th, 2000, 02:11 PM
#2
Monday Morning Lunatic
Use:
The c_str() member function of the string class returns a const pointer to the character array. Basically, it's like saying:
Code:
char *pcStr = "Hello"
CString x = pcStr;
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 4th, 2000, 02:38 PM
#3
Thread Starter
Frenzied Member
Thanks ,that's just what i was looking for.
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
|