I could really use help, please! I'm stuck and frustrated.
public const void *myFilePtr
and I need to cast it as a:
I've tried using:
int *Filepointer = const_cast<int *>(myFilePointer);
but the class I'm trying to do the cast in is a const class too and I keep getting the error:
passing `const namespace' as `this' argument of `int namespace::myBinarySort(int *filePointer, const string& searchString, int low, int high)' discards qualifiers"
Which I know means I'm still using a const when I shouldn't.
Can someone tell me how to cast this correctly so this const stuff goes away? It's not an option to change what things are marked const sadly.
More Details in case that's not enough:
public const void *myFile;
and I have to implement the following class in program.cpp:
bool namespace::getInfo(const string& name, vector<foo>& foo) const
from this class I need to call a binary sort function I wrote as follows:
int namespace::myBinarySort(int *filePointer, const string& searchString, int low, int high)
which I need to return an int pointer to the memory address where searchString is found
And I make the call like this:
int myData = myBinarySearch(mySendingFile, myString, low, high);
So the part I'm having trouble with is correctly casting mySendingFile as int *mySendingFile;
Thanks very much if anyone can help me get unstuck!
Sorry, I've never posted for help before I'm new to the forums. I thought the information I provided was relevant. I'm sorry for wasting your time. I obviously just do not know what I'm doing at all. So sorry.