|
Is there a reason you want it in one line?
A small loop can handle it with a lot more clarity and maintainability.
|
|
|
|
|
Hello all,
I have implemented an http server in which whenever the client requests a file, my server sends the file. My client is Windows Media Player and I generate the request from the "Open URL" option.
Now I want to implement that whenever client requests a file, the sever should send the same file continuously in a loop, and the client should play that file in a loop.
Can anybody help?
Regards,
Harshita
|
|
|
|
|
I have a project which when compiled by VC++ 2003 Pro produce a DLL of 145KB. When I compile this project in VC++ 2005 Std the DLL is 158KB.
Does this mean VC++ 2003 produces better code ?
BTW, the project in question is a Monkey's Audio input plugin for the QCD audio player (http://quinnware.com/bin/plugins/input/sup_QCDApeSrc.zip)
|
|
|
|
|
I have seen the same thing with regard to the size of the code produced, but unless you make the distinction that smaller code = better code, then you cannot say that the small stuff is better. There is probably more error handling and checks in the 2005 version as well as default settings could be different.
Steve Maier, MCSD MCAD
|
|
|
|
|
I have a class called Point. I am creating a class called Point3D that is inherited from Point. Point has private data members int xCoord, yCoord. Point also has functions called getX() and getY().
Point3D is inheriting from Point. Point 3D has a new datamember int zCoord. Point also has a function distanceFrom that looks like this:
double Point::distanceFrom(Point& p) { //distance between this point & p
return sqrt((xCoord - p.xCoord) * (xCoord - p.xCoord) +
(yCoord - p.yCoord) * (yCoord - p.yCoord));
}
Point's header file looks like this:
class Point{
public:
Point(); //default constructor
Point(double, double, string); //conversion constructor
double getX() const;
double getY() const;
string getName() const;
void setX(double);
void setY(double);
void setName(string);
double distanceFrom(Point&);
void printP();
private:
double xCoord, yCoord; //coordinates of the point
string name; //name of the point
};
so I am trying to overload the distanceFrom function to use the zCoord. Here is what I have:
double Point3D::distanceFrom(Point3D& p3D)
{
return sqrt((p3D.getX() - getX()) * (p3D.getX - getX()) +
(p3D.getY() - getY()) * (p3D.getY() - getY()) +
(p3D.zCoord - getZ()) * (p3D.zCoord - getZ()));
}
but i am getting these errors:
error C2475: 'Point::getX' : forming a pointer-to-member requires explicit use of the address-of operator ('&') and a qualified name
error C2475: 'Point::getX' : forming a pointer-to-member requires explicit use of the address-of operator ('&') and a qualified name
error C2296: '-' : illegal, left operand has type 'double (__thiscall Point::* )(void) const'
can anyone shed some light why i cannot do this? I just want to inherit the functions from Point (getX getY) to get x and y values. then get my z coordiate to get the distance.
Thank you,
Ed
|
|
|
|
|
Ed, does this work?
return sqrt((p3D.getX() - <code>this.</code>getX()) * (p3D.getX - <code>this.</code>getX()) + etc... /ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Thank you for the quick response, however, i get this...
error C2228: left of '.getX' must have class/struct/union type
error C2228: left of '.getX' must have class/struct/union type
???
|
|
|
|
|
Argh - I'm blind. The code has a typo. The compiler error is referring to getX when you probably I meant getX() .
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
-- modified at 15:50 Tuesday 25th April, 2006
|
|
|
|
|
Thanks again for the quick response ravi.
I made the changes to :
double Point3D::distanceFrom(Point3D& p3D)
{
return sqrt((p3D.getX() - this.getX()) * (p3D.getX() - this.getX()) +
(p3D.getY() - getY()) * (p3D.getY() - getY()) +
(p3D.zCoord - getZ()) * (p3D.zCoord - getZ()));
}
I am still getting that error.
Funny, when i comment the first line out
double Point3D::distanceFrom(Point3D& p3D)
{
return sqrt(//(p3D.getX() - this.getX()) * (p3D.getX() - this.getX()) +
(p3D.getY() - getY()) * (p3D.getY() - getY()) +
(p3D.zCoord - getZ()) * (p3D.zCoord - getZ()));
}
it's a okay!
here are my declarations from my point class...
double Point::getX() const {
return xCoord;
}
double Point::getY() const {
return yCoord;
}
|
|
|
|
|
nevermind, i got it. thanks Ravi!
|
|
|
|
|
etm124 wrote: return sqrt((p3D.getX() - getX()) * (p3D.getX - getX()) +
The third getX is missing the parentheses to make it a function call.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
If have MFC MDI application how can I use all new Office 12 styles in my application.
Do you know is any SDK available to get this styles from Office 12
If yes is it unmanaged and is it support Windows XP?
I saw a lot of third party components which looks similar to Blue Ribbon but nothing from the MIcrosoft.
Thanks for any info.
|
|
|
|
|
CodeJock has them.
http://www.codejock.com/[^]
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Thanks very good selection
|
|
|
|
|
I think the blue Ribbon is fugly, please don't copy it.
But you should probably wait until Office 12 is released before starting to copy its UI. Look at all the poor folks that copied the beta 1 Ribbon - they now have to redo all their work because the beta 1 UI was just temporary.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Thanks, I like your comment
|
|
|
|
|
typedef string *ptrstr;<br />
const ptrstr cstr; //this is wrong
What is the type of cstr ?
What underlying type does a pointer const ptrstr represent?
Not a question, more in the form of a quiz.
They say most progammers interperate this wrong.
|
|
|
|
|
With your games you are sending real doubts down to the other page...
|
|
|
|
|
Yeah, most programmers will really "interperate", especially those who post such questions.
|
|
|
|
|
#hackC++ wrote: typedef string *ptrstr;
const ptrstr cstr; //this is wrong
What is the type of cstr ?
What underlying type does a pointer const ptrstr represent?
Somebody please ask #hackC++ to use this way to get his answer by:
std::cout << typeid(cstr).name();
Maxwell Chen
|
|
|
|
|
Looks like he has just discovered C++ for himself and it thrills him...
|
|
|
|
|
#hackC++ wrote: What is the type of cstr ?
It is a const ptrstr , but it will need to be initialized.
#hackC++ wrote: Not a question, more in the form of a quiz.
How can it not be a question if it ends with a question mark?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
my grammer and english is not what you call "good". bare with me. please.
string *const cstr;
is the correct way.
-- modified at 14:56 Tuesday 25th April, 2006
|
|
|
|
|
I think David is he not she, so he would not want to bare with you.
|
|
|
|
|
#hackC++ wrote: string *const cstr;
is the correct way.
You wanted to know what cstr was, not ptrstr . cstr is a const ptrstr , while ptrstr is a string* .
In any case, you are mistaken. While const string *cstr and string const *cstr are interchangeable, string* const cstr is completely different.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|