Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

c++ struct initialization error

$
0
0

I am beginner in mfc ; I am trying to test send email and for

that trying to initialize struct as defined  below :

struct TEmailData
{
  char user[EMAIL_USER_LEN];
  char password[EMAIL_PASSWORD_LEN];
  char to[EMAIL_TO_LEN];
  char cc[EMAIL_CC_LEN];
  char subject[EMAIL_SUBJECT_LEN];
  char body[EMAIL_BODY_LEN];
  bool skipXfer;
};


 char usr[260]={'p','r','o','v','s','v','r'};
   char pwd[260]={'p','r','o','v','s','v','r'};
   char to[260]={'x','x','x','x','x','x','x','x','@','x','x','x','x','.','c','o','m'};
   char sub[100]={'t','e','s','t'};
     char bdy[1000]={'t','e','s','t'};


TEmailData dt={usr,pwd,to,null,sub,bdy,1};

I am getting error: 

 error C2440: 'initializing' : cannot convert from 'char [260]' to 'char'

I also tried 

dt.user=usr but this gave error  left operand must be l_value

How can I initialize TEmailData ? any help will be appreciated 



Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>