Under your current scenario, I cannot think of a solution other than a void pointer. In general though, the use of void pointers in C++ is indicative of a design flaw.
What are you trying to achieve?
If pObj is always intended to be a ponter to an instance of classB, then the following will also work for you...
class classB; //forward reference
class classA
{
public:
int classtype;
int dummy;
classB * pObj;
};
class classB
{
public:
int classtype;
int dummy;
};
classA...
Since this is C++ code, you could try making use of the STL.
Something like..
[code]
struct StudentRec
{
bool operator < (StudentRec &rhs)
{
return name < rhs.name;
}
string name;
float average;
};
struct Roster
{
vector<StudentRec> student;
};
int main()
{
//set up test data...
If I understand your post correctly, you have a Race class that looks something like
class Race
{
public:
void SetName(string &);
void SetDescription(string &);
void SetUID(long);
private:
string name;
string description;
long UID;
};
and a data file that looks like..
string1...
If you have six text boxes, some of which could be empty, you could try something like this...
Dim myArray(6) As String
myArray(0) = Text1.Text
myArray(2) = Text2.Text
myArray(3) = Text3.Text
myArray(4) = Text4.Text
myArray(5) = Text5.Text
myArray(6) = Text6.Text
Dim segString As String
For...
Is this what you are trying to achieve?
fstream fs;
char name[] = "save.txt";
fs.open(name, ios::in)
if(fs.fail())
{
cout << "this shows at runtime" << endl;
fs.clear();
fs.open(name, ios::out);
}
std::multimaps and std::maps contain pairs, not individual elements.
The following should work for you...
multimap<int, string, less<int> > mmid;
string temp = "hello";
mmid.insert(make_pair(30, temp));
GetFile requires a pointer to a C style string as its first argument. It looks like the name of your string variable is RFile. If this is the case, the following should work..
ftpConnection->GetFile(RFile.c_str() , "C:\\dumped\\newfile.txt", FALSE);
Good to see that the set container worked for you.
To read in the file name as a command line argument, replace
ifstream infile("input.txt");
with
ifstream infile(argv[1]);
Can you please provide a little additional detail relating to the format of the input. For example woukld the following be acceptable input..
poly1: 3x^3 + 2x^2 + x
poly2: 2x^4 + 3x^2
Or would the required input be..
poly1: 0x^4 + 3x^3 + 2x^2 + x
poly2: 2x^4 + 0x^3 + 3x^2 + 0x
I suppose what...
What is your question? As palbano stated, you only have warnings which will not prevent a clean compile. The #pragma will get rid of the warnings if you put it in the right place.
Now that I understand what you are doing, there is a much easier way to do this using the STL
The STL container set<typename T> allows the insertion of unique elements only. All you have to do is parse the input lines to get the desired substring and insert into the set. Since the set container...
Now that I have some real data to test, I have found one problem that was my fault - I coded your original VB program very literally without considering the consequences.
As I said previously, if your input is less than 200 chars, one of the substr functions will eventually try and access...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.