Appending to the front of a string in a class...
Code:
#include <iostream.h>
#include "ooint.cpp"
main()
{
ooint ooint1 = "100";
cout << ooint1 << " ";
ooint1.intcat("1");
cout << ooint1 << " ";
ooint1.intfcat("3");
cout << ooint1 << " " << "\n\n";
return 0;
}
There's my program... and in the implimentation file:
Code:
void ooint::intfcat(const char * Int1)
{
//char Int2[(strlen(Int1))+(strlen(CString))];
char Int2[1024];
for (int i=0; i<=strlen(Int1); i++)
Int2[i] = Int1[i];
strcat(Int2,CString);
strcpy(CString,Int2);
}
It gives me a weird error: (see attatchment on next post)
If I click Ignore, it does what I want as output:
100 1001 31001