I do need some help. I don't know if anyone here could help me out about this but here's my issue;
I have an array tline[10 (the number of lines allowed) ][200 (the number of characters allowed) ] that has 4 strings in it. I need to feed these 4 strings into a char array. I made a second char array copy[10][200] to copy the string into the char array. This is the bit of code that I'm using
and these are the two errors I'm getting:
error C2228: left of '.c_str' must have class/struct/union error C2664: 'strcpy' : cannot convert parameter 1 from 'char' to 'char *'
Please I hope someone can help me out with this. This is a huge issue that needs to be overcome before continuing with my project.
EDIT: I no longer receive error C2664, I don't know what I did but it's seemed to righted itself
The type of tline[j][h] is char. char is not a struct/class/union and therefore cannot have a member named "c_str".
Note also that the type of copy[j][h] is also char.
strcpy takes two parameters -- one is const char* and the other char*. Both of your parameters are chars (after fixing the above compile error). This should give you a hint that something else is wrong with your inner for loop/strcpy combination.
The syntax "a.b" is used when a variable "a" has a type that is a struct/class/union which contains a member "b".
In your case "a" is char. char does not have a member "c_str".
You are perhaps confusing C-style strings (char*) with the C++/STL string class.
The string class contains a member function c_str() which returns a C-style representation of the contained string.
You will need to remove ".c_str". Once you do this, your code still won't work, because you've now declared two two-dimensional arrays of C-strings. You wanted two one-dimensional arrays of C-strings. Your declarations of copy and tline were correct in the first place, but your inner for loop is wrong.