Anyidea what that means? I get it whenever i use the syntax check on Dev C++ 4.9.9.2. But not when i compile..Code:1 C:\path\index.cpp [Warning] `nul.gcda' is not a gcov data file
Also, I'v got a question about the following code.
If you notice i am taking a files data, storing it in a string (Thanks LithorienCode:class cItemHandle { public: cItemHandle(); ~cItemHandle(); float returnValue(string itemName); bool setValue(string itemName); private: string fileData; }; cItemHandle::cItemHandle() { ifstream iFile("stats.dat", ios::ate); int size = iFile.tellg(); iFile.seekg(0, ios::beg); char* ch = new char[size]; iFile.read(ch, size); fileData = ch; iFile.close(); } cItemHandle::~cItemHandle(){} float cItemHandle::returnValue(string itemName) { int stringStart = fileData.find(itemName,0); int stringLineEnd = fileData.find("\n",stringStart); int valueStart = stringStart + itemName.length() + 1; int valueLen = stringLineEnd - valueStart; cout<<"\nName: "<<itemName; cout<<"\nStarts At: "<<valueStart; cout<<"\nEnds At : "<<stringLineEnd; cout<<"\nReturn Value: "<<fileData.substr(valueStart,valueLen); return 0.1; } bool cItemHandle::setValue(string itemName) { return false; }) and doing various things with it. Well i'v got a question about the return values..
I could easily deal with the return values all being float's, which is what i first planned on. But i decided i might try to expand on that, though i dont know how to handle such things.
Seeing as a method must first run through the string to find the value (which is in this format)
how can i deal with the return type? like i said originally i planned on them all being float values but then decided to see if i could change it to any type. I mean if i could just do a simpe if to check what types they are, thats one thing, but then i still cant return any type.Code:item1=value item2=value item3=value
Down the road when i am pulling data from the string's item values for calculations and whatnot, i should know what everythings data type is (ie height=float, name=string), so that shouldent cause any problems.. i am more concerned about programming for multiple return types.
So how could i handle multiple return types? Thanks



LinkBack URL
About LinkBacks
) and doing various things with it. Well i'v got a question about the return values..


