I could really use help, please! I'm stuck and frustrated.
I've got:
public const void *myFilePtr
and I need to cast it as a:
int *FilePointer
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:
in program.h
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!
Please use [code][/code] tags when posting code.
Please provide a minimal, but complete example of your problem. The (pseudo)code snippets you have posted are unrelated.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
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.
Bookmarks