Jag gjorde en class som såg ut såhär:
#include <iostream>
#define tMB 1024*10
class fInfo{
public:
int Version;
int fAmount;
char *fName;
int fSize;
char *fContent;
void print();
};
void fInfo::print() {
printf("%i",fAmount);
printf("%i",Version);
printf("%s",fName);
printf("%i",fSize);
printf("%s",fContent);
}
Nu är det så att jag deklarerar "fInfo info;" och kör en forloop där jag vill lägga till en char, men det är då problemet uppstår.
for(int n=25;n<25*(i+1)+info.fSize;n++) {
strcpy(container[i][n],buffer[i]);
strcpy(info.fContent,container[i][n]);
}
Error: argument of type "char" is incompatible with parameter of type "const char*"
Dock har jag definierat buffer som: char *buffer;
Och container som: char *container[10][10240];
Enkelt sagt vill jag alltså kunna lägga in data från en array vid fler än ett tillfälle i min klass.
Tillägg av Lll 2010-08-06 19:42
char *buffer[tMB]; Error: argument of type "char **" is incompatible with parameter of type "char *" @ strcpy(buffer,tcpRecv(tMB));
char buffer[tMB]; Error: argument of type "char" is incompatible with parameter of type "const char *" @ strcpy(container[i][n], buffer[n]);
char *buffer=new char[tMB]; Error: argument of type "char" is incompatible with parameter of type "const char *" @ strcpy(container[i][n], buffer[n]);
http://pastebin.com/X53kaNkF
char *buffer[tMB]; Error: argument of type "char **" is incompatible with parameter of type "char *" @ strcpy(buffer,tcpRecv(tMB));
char buffer[tMB]; Error: argument of type "char" is incompatible with parameter of type "const char *" @ strcpy(container[i][n], buffer[n]);
char *buffer=new char[tMB]; Error: argument of type "char" is incompatible with parameter of type "const char *" @ strcpy(container[i][n], buffer[n]);
http://pastebin.com/X53kaNkF
Go ahead, make my day