Hey, I am working on a project and I want to know how to return a class object that is a Character Array. I am having trouble with it and can't find out any way to do this. Thank you for taking the time to help (:

Recommended Answers

All 3 Replies

Just change your vector to array/char*.. it'll do the same thing.

class SomeObjectClass
		vector<char> DataHolder;
	vector<char> SomeFunc(SomeObject &Obj)
		return DataHolder;

I am not using a vector. I need to change a character array into a variable integer.

What? Char Array to Int Array you mean?

//Our Char Array..
char Returned[5];
int IntArr = new int[sizeof(Returned);

for (int I = 0; I < sizeof(Returned); I++)
   IntArr[I] = (int)Returned[I];
for (int I = 0; I < sizeof(IntArr)/sizeof(int); I++)

delete [] IntArr;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.