Member Avatar for TheFearful

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 (:

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

class SomeObjectClass
{
	private:
		vector<char> DataHolder;
	public:
		SomeObjectClass(){}
		~SomeObjectClass(){}
		
	vector<char> SomeFunc(SomeObject &Obj)
	{
		return DataHolder;
	}
};
Member Avatar for TheFearful

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++)
   cout<<IntArr[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, networking, learning, and sharing knowledge.