+ 1
~ swim ~ Will it work if for example we create a temporary string object first (just to mix the e-mail and password in) then assign the temporary string buffer into a constant char pointer, maybe like this; string email {"my_e-mail"}, pass {"my_password"}; string s {"INSERT INTO Accounts (EMAIL, PASSWORD) VALUES ('" + email + "', '" + pass + "');"}; const char* sql = s.c_str(); printf("%s\n", sql); // verify But is this right by standard? I don't know ...
13th Jan 2020, 11:43 AM
Ipang
+ 1
Yes I get it. So we can't use the <sql> variable outside function because the data it refers to is a local variable <s> string 👍
13th Jan 2020, 12:57 PM
Ipang