|
have you sized the drop-down space on the resource editor? the default is a drop down of zero-height (i don't know why).
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
*grin* A friend asked me to look at his code three times over 2 days once before I suddenly remembered that little quirk.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
What's is the equivalent function for IPv4 inet_addr for using with IPv6 address ?!?! Using VC++ and Winsock 2 in Windows XP Pro.
I read about WSAStringToAddress, but not working so well !!
I Hope someone can help.
Thank's....
"Fear is the first step for knowledge !!"
|
|
|
|
|
getaddrinfo()
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
how getaddrinfo can be used, for converting IPv6 IP to Network byte order
|
|
|
|
|
Hi all,
I want to distribute my client app. (that consumes a web service) to Win98/2000/XP, and I don't want to have to include the .NET install, so I guess C# is out.
What tool could I use to consume the web service? (i.e. SOAP Toolkit)
Do you have to distribute extra files if you code the client in VC7?
If I developed the client in VC6(MFC), I shouldn't have to distribute exta files on Win98/2000/XP, correct?
Thanks in Advance.
Soliant | email
"The 'B' in Visual Basic means Beginner" - R. Bischoff
|
|
|
|
|
This[^] article may help if you're looking for a simple yet effective way to consume a web resource.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Does anyone know hoew to do this?
namespace {
int anon;
}
void func() {
// breakpoint on some code in here,
// try to examine anon's value
}
I've tried typing in all kinds of things in the watch window, including `anonymous namespace'::anon (same prefix as anonymous namespace functions in the call stack).
I've looked through msdn, searched google, tried to
unmangle the name using a map, used windbg, but to no avail.
If anyone knows the answer to this, please let me know.
Thanks,
Tim
|
|
|
|
|
Assuming that func can see the value, try setting a local variable to equal anon inside func, and then view it's value. I doubt you can see into the namespace directly, if 'anon' does not work. I would have expected it to, if the namespace is in scope where you are looking.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I've done that before, but it's a real drag to have to do everywhere I'd like to look at a variable's value. Since the debugger can examine _all_ of the symbols in a module, it ought to be able to "see" anonymous variables. WinDbg can see it, but only by wildcarding everything.
|
|
|
|
|
I agree - your example is obviously contrived to show the problem and the real code is probably more painful than that to do this to. I don't know what the solution is, and if you find one, I'd love to hear it.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hi Tim,
While I have not used this with variables in anonymous namespaces, you should be able to setup a watch variable by using the address of the variable.
If you setup a breakpoint at a place that uses the variable, you can open the Disassembly window and find the address of the variable. I tried a sample program which did "cout << anon << endl;", and the disassembly showed:
mov eax,['anonymous namespace'::anon (00476dc0)]
The 00476dc0 is the address of the anon variable for my program. When you run this, it most likely will be a different address.
Once you have the address of the variable, you can setup a watch for it as follows:
* (int *) 0x476dc0
Substitute the address that you get for the 0x476dc0.
This tells the debugger to treat the address as a pointer to int, and then dereferences it. If you want, you can use:
(int *) 0x476dc0
You then get a plus sign which you need to expand to get to the value. For a single value, this isn't useful, but if you have an array, it can be very useful. For instance, if you had the following:
namespace
{
int array[5] = {5,4,3,2,1};
}
Once you find the address of the array in the debugger, you can display the array in a watch window as follows:
((int *) 0x476dc0),5
Again, replace address with the one found in the debugger. This will put a + next to the expression which will expand to 5 elements when clicked.
Best regards,
John
|
|
|
|
|
Thanks so much for your help! I had totally overlooked using the disassembly window! I was also able to cast a pointer to a structure too:
*(SaveParams*)(0x007b1280)
Again, thanks!
Best Regards,
Tim
|
|
|
|
|
In WinDBG:
>dt myapp!*anon
You will see somethin like that:
>myapp!?A0x423ba21e::anon
For search address for global variable, you should type:
x myapp!*anon*
You will see:
016255aa myapp!?A0x423ba21e::anon = [address]
Next, type:
>dt myapp!?A0x423ba21e::anon [address]
Note:
anon will optimized in release build
|
|
|
|
|
Well done - you're only 14 years late!
How long did it take you to read 7712 pages of this forum?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
it's just help for other
|
|
|
|
|
I'm working on this program and it has me stumped!!! Any help would be grateful. I'm trying to have the computer tell me if it is a triangle or not....if it is a triangle it has to tell me if it is an equil., isosoceles, or scalene. If it is not a triangle then I need to have my else statement. For some reason I just can't get it perfect. Thanks again!!
#include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
using namespace std;
const string EQUIL = "equilateral";
const string ISOS = "isosceles";
const string SCALE = "scalene";
void DisplayOpeningScreen();
void Print6BlankLines();
int main()
{
int side1;
int side2;
int side3;
int halfper;
int area;
string equil;
string isos;
string scal;
// Display an opening screen and explain the program to the user
DisplayOpeningScreen();
// Have the user input 3 values representing the sides of a triangle
cout << "\nEnter first side of triangle: ";
cin >> side1;
cout << "Enter second side of triangle: ";
cin >> side2;
cout << "Enter thrid side of triangle: ";
cin >> side3;
if ((side1 + side2) > side3 && (side2 + side3) > side1 && (side1 + side3) > side2)
{ cout << "\n\nThe three lengths can form a triangle.\n\n";
if ((side1 == side2) && (side2 == side3) && (side1 == side3))
equil = EQUIL;
cout << "This triangle is an " << equil << endl << endl;
else if ((side1 == side2) || (side2 == side3) || (side1 == side3))
isos = ISOS;
cout << "This triangle is an " << isos << endl << endl;
else;
scal = SCALE;
cout << "This triangle is an " << scal << endl << endl;
}
else
{
cout << "\n\nThe three lengths can not form a triangle.\n\n";
}
return 0;
}
//********************************************************************************************************************************************
void DisplayOpeningScreen()
// Purpose: Explains the program to the user
{
cout << "\n Welcome to the \"Triangle Program\"\n";
Print6BlankLines();
cout << " You will be asked to enter 3 integer values to represent the sides of a triangle.\n";
cout << " A message will be printed stating whether or not the 3 lengths can form a triangle.\n";
cout << " For valid triangles, a messge corresponding to the triangle's type will be printes.\n";
cout << " Finally, the area of the triangle using Hero's formula which is:\n\n";
cout << " area = squareroot (s)(s - a) (s - b) (s - c)\n";
Print6BlankLines();
// Pause and then clear the screen
system("pause");
system("cls");
}
//********************************************************************************************************************************************
void Print6BlankLines()
// Purpose: Prints 6 blank lines on the output screen
{
cout << "\n\n\n\n\n\n";
}
I know I haven't used the area and the halfper yet....I need to figure out this part first!!! Thanks everyone!!
Autumn
|
|
|
|
|
In order to make your include files visible, you need to check the 'display message as is' checkbox under the message as you type it.
Your problem is that your if/else statements are not scoped.
If I were to run this:
int i = 1;
if (i==0)
cout << "it's zero ";
cout << "I wish it was one ";
cout << "it's one";
the result will be
"I wish it was one it's one".
Python scopes things in blocks, C++ does it with the curly brackets. Unless you do this:
int i = 1;
if (i==0)
{
cout << "it's zero ";
cout << "I wish it was one ";
}
cout << "it's one";
the language will automatically only make the first line after the if statement conditional on the statement above it.
In this case, it's kind of pointless making the type a variable and then outputting the type directly, you should instead just print the value in the variable after deciding what sort of triangle it is.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Try this
if ((side1 == side2) && (side2 == side3) && (side1 == side3))
{
equil = EQUIL;
cout << "This triangle is an " << equil << endl << endl;
}
else if ((side1 == side2) || (side2 == side3) || (side1 == side3))
{
isos = ISOS;
cout << "This triangle is an " << isos << endl << endl;
}
else;
{
scal = SCALE;
cout << "This triangle is an " << scal << endl << endl;
}
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Gary....thanks for your help.....this would work expect for my else statement at the end state that the triangle is false. I need to find a way to have the three different kinds of triangle be with if it is a triangle statement. I only want to prove if it is a triangle and what kind. If it's not a triangle then have my else statement stating it.
Sorry about this problem I'm having!!!
Autumn
|
|
|
|
|
You need two nested if statements, the first to establish if it's a triangle, the second to establish what sort. You should also output the type of triangle once, based on the variable you set.
You should also put using std::cout; and using std::cin; instead of using namespace std; - there is no point having namespaces if you're just going to negate them in one fell swoop.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
there is no point having namespaces if you're just going to negate them in one fell swoop.
maybe you should take up the "using" keyword with the C++ standard body.
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Chris Losinger wrote:
maybe you should take up the "using" keyword with the C++ standard body.
According to Stroustrup, using an entire namespace is useful if it is within a limited scope, and has other application ( I forget the rest, and don't have a copy at work ), but should generally be avoided in favour of the syntax I suggested.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
According to Stroustrup
yeah yeah. the same guy who decided that "static" needed yet another meaning.
-c
“losinger is a colorizing text edit control”
-- googlism
|
|
|
|
|
Now you're just trying to wind me up......
I agree with him in principle that new keywords should be created sparingly, but a lot of mistakes get made in the pursuit of noble goals.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|