Re-casting array to store inside a vector

I'm having a weird problem. I have an array which I need to return to another function. The problem is that it has to be outputted/converted as a

(unsigned)(unsigned char)

The function which handles the data is a char* type. Here is the function in which I am converting the data:

char* Wav::readHeader(ifstream &file)
{>chunkId,                                 4);<char*>(&this->chunkSize),     4);>format,                                  4);>formatId,                                4);<char*>(&this->formatSize),    4);<char*>(&this->format2),       2);<char*>(&this->numChannels),   2);<char*>(&this->sampleRate),    4);<char*>(&this->byteRate),      4);<char*>(&this->align),         2);<char*>(&this->bitsPerSample), 4);

char testing[4] = {0};
int testingSize = 0;

while(, 4) && (testing[0] != 'd' ||
                                testing[1] != 'a' ||
                                testing[2] != 't' ||
                                testing[3] != 'a'))
{<char*>(&testingSize), 4);
    file.seekg(testingSize, std::ios_base::cur);


this->dataId[0] = testing[0];
this->dataId[1] = testing[1];
this->dataId[2] = testing[2];
this->dataId[3] = testing[3];<char*>(&this->dataSize),     4);

this->data = new char[this->dataSize];,                           this->dataSize);

for(unsigned i=0; (i < 20); i++)
    //cout << (unsigned)(unsigned char)data[i] << endl; 


return (unsigned)(unsigned char) data;

And in another function, I have this:

unsigned char* data = this->readHeader(file);

Can anyone see where I'm going wrong?

Thank you :)


this->data = new char[this->dataSize];

So, presumably, this->data has type char*. Fine: that's the return type for the function, too. So return data seems like the correct code.

Need Your Help

Need help - Haskell Replace

string list haskell replace

I need to change one string from a list of strings (chars if a string is just one letter) for another one from the other list. The signature looks like this:

Simple curses.h program, nothing is showed in terminal

c osx netbeans

I have to use a curses.h library to my school project. We are programming in NetBeans. I am trying to create just simple program on my mac, everything seems be good. Code is compiled, a new terminal

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.