This is a newbie type of question. I have a file saved using writeObject method in java. I need to read using C++ for a C++ based code. I tried to read using binary file read method while I could not read properly.
char buffString[50];
char buffer[100];
std::ifstream conFile(configFileName, std::ios::in|std::ios::binary);
//conFile.read(buffer, 100);
std::cout << buffer << std::endl;
if (!conFile) {
std::cout << " Error reading thee file " << std::endl;
} else {
std::cout << "Trying to read." << std::endl;
conFile.seekg(0);
conFile.read(buffer,14); strcpy(buffString, buffer);
std::cout << buffString << " buffer " << buffer << std::endl;
}
The datafile pointed to by this conFile contains string, integer and double. The file contains something like the following:
trapezDET.pngtcmstMeVsrjava.lang.Double���J)k�Dvaluexrjava.lang.Number��� ���xp@dsq~@Nsq~@dsq~@V�srjava.lang.Integer⠤���8Ivaluexq~sq~?�sq~ sq~?ə�����sq~ q~sq~@F�sq~?�sq~?�sq~?�sq~?�z�G�{t5/home/vega/NetBeansProjects/Tom/data/6133.root
I searched the net while I could not figure it out. Thanks and regards