I don't see quite the problem. The code below works fine:
Code:
#include <iostream>
#include <fstream>
#include <ios>
using namespace std;
void print_array(unsigned*, unsigned);
int main(int argc, char *argv[])
{
unsigned x[5]={0};
unsigned i(0);
ifstream ifs("in.txt");
//Let's fill the array from file.
while( ifs>>hex>>x[i] )
{
++i;
}
print_array(x, 5);
//Whatever this means :)
unsigned ip = ( (x[0] & 0xf0000000)>>28);
cout<<hex<<ip<<endl;
return 0;
}
void print_array(unsigned* arr, unsigned size)
{
for(unsigned j = 0; j < size; ++j)
{
cout<<hex<<arr[j]<<endl;
}
}