|
oh, that's better now but the #include still don't appear. be carful to type & l t ; to see a < and a & g t ; for a > .
ok, now, you parser seem to be parser a little than one i wrote before. I cannot say to you what is wrong in your code, but I can give you an advice. see the source of my VisualCalc to perform your code...
If you need any question about your source, ask it to me here ; if it is about my code, post your request at the bottom of the VisualCalc article.
See you,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I used the swab function to swap the data in a struct and then write it to a file. If I have two data structs that writes to one file, can I swap the bytes individually before writing them separately to the file or would I need to store them in a third struct (combo of the two), swap the bytes and then write to a file?
Scenario 1: read struct a, swap bytes, write to file
read struct b, swap bytes, write to file
Scenario 2: struct c is a combination of struct a and b
store struct a in struct c
store struct b in struct c
swap bytes in struct c
write to file
|
|
|
|
|
I don't know if this is the right forum, so bear with me. I'm pretty new, and I just need some help stopping the infinite loop that is occuring in my programming. The bit that is causing problems is pretty simple, but I can't figure out the problem! Here it is:
void Error_day()<br />
{<br />
int enter1;<br />
<br />
cout << "That is not a day!\n";<br />
cout << "Type 'C' then press 'enter' to continue...\n";<br />
cin >> enter1;<br />
<br />
get_info();<br />
}
Any help would be appreciated. Thanks
Only Neo is me, no Cleo can see, my future, if she did I'd shoot her!
|
|
|
|
|
You have to type in an integer to get rid off cin , or change enter1 from int to char to accept any character.
ARSALAN MALIK
|
|
|
|
|
if u want the ascii value.....go ahead and declare enter1 as int type but get it with functionz like getch() or getche(),or some function other than cin
if u want to use cin ,then declare the enter1 as char type
hope that helpz.....
happy programmin.....
cheerz.....
|
|
|
|
|
This might be obvious, but in many cases you must hit return before input is accepted. That is if you type the number but don't hit the enter key input will not be returned, even though you typed it!
Beginners mistake, but you did say you were a beginner.
|
|
|
|
|
Hello all,
Would anyone tell me that how C++ prevent the static variable been created more than one? Eg, if I have a function that contains a static variable:
<br />
void f() {<br />
static classA a;<br />
a.print();<br />
}<br />
<br />
void main() {<br />
f();<br />
f();<br />
}<br />
How C++ prevents the static variable "a" inside the function to be constructed twice rather than once? If I inline the function f(), will it still works?
Thanks!!!
Nacho
|
|
|
|
|
Hi Nacho,
The static variable will get created only once (exactly, the first time f is invoked.) Are you observing something different?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
Hello,
Yes, I know that the static will created only once. But I want to know how C++ actualy implement this. And I want to know whether doing inline of f() will break the rule?
Thanks!
Nacho
|
|
|
|
|
But I want to know how C++ actualy implement this,
Well, how the compiler implements this feature is up to the compiler alone, I guess. You can assume the internally generated code will resemble in some way the following:
static bool __f_a_initialized=false;
static char __f_a_storage[sizeof(classA)];
void f()
{
if(!__f_a_initialized){
new (__f_a_storage) class A;
__f_a_initialized=true;
}
...
} Do not take this as the actual procedure implemented, it is just an approximation to what the compiler probably does. Does this answer your question?
And I want to know whether doing inline of f() will break the rule?
The rule does not break even if you declare your function inline .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
I m trying to place two dialogs (different types) one beneath the other , like a Horizontal Tile operation .
I need to compute the top Y coordinate for the bottom Dialog for which i need to take into account the height of the title bar of the First dialog
What is the API call to get this value ?
|
|
|
|
|
Look at GetSystemMetrics() and pass SM_CYCAPTION as its parameter.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I would like to start writing apps for my pocket pc running windows ce. I've just downloaded eMbedded Visual C++ 3.0 and I don't have a handle on it just yet. Can anyone direct me to a tutorial or a site for learning eMbedded?
Also, I've tried to enter some of my code into eMbedded (which compiles in .net) and it didn't work. Then I tried something simple. Why doesn't this code work in eMbedded:
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World";
return 0;
}
Thanks!
-Wp
|
|
|
|
|
I am using DirectX 9 with VS.Net 2002. When I call the Direct3DCreate9 macro I recieve an unresolved external error when the project links. I have included the platform sdk lib and include files as part of my .net setup and they are both at the top of the list. I am unsure of why I am recieving this error. Any help will be much appreciated.
|
|
|
|
|
Did you include d3d9.lib? If that doesn't help, include d3dx9.lib.
|
|
|
|
|
Thankyou for the help. Evidently I wasn't including the libraries in the right area in the project setup. Once I moved everything over to the additional dependencies area it all seemed to work out. I appreciate the help.
|
|
|
|
|
I have made my own compressed sound format, and i wish to play it as i decompress it back to pcm format.
The problem is this.
I wanna play them on the fly, as i decompress the music. Each music frame decompressed is 256 samples.
So a compressed music file, consists of alot of frames.
The few methods i have found to play music, requires a buffer to the entire length of the PCM data. Since that would require alot of ram, i see that as a problem, besides the fact, that it decompresses the entire file then plays the music.
|
|
|
|
|
I'm having a great deal of trouble with a Wizard97 design...
Briefly, Page 2 of the Wizard has 3 Radio Buttons.
Clicking "Next" takes you to page 3.
But how do I know what Radio Button was clicked from Page 2?
I would like to attach my code to this message, but I don't see how to do it. (?)
The code is very simple, but just doesn't seem to work and I can't see why it won't work!
|
|
|
|
|
if (((CButton*)GetDlgItem(IDC_MY_RADIO1))->GetCheck() == BS_CHECKED) {
}
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I wish it would work that way, but alas, it doesn't.
I keep getting an error message...
c:\Projects\Simple Wizard\Wizard.cpp(299): error C2039: 'GetChecked' : is not a member of 'CWnd'
|
|
|
|
|
The function you are looking for is GetCheck()
it returns one of BST_UNCHECKED , BST_CHECKED or BST_INDETERMINATE
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Now I get...
c:\Projects\Simple Wizard\WC_Wizard.cpp(295): error C2039: 'GetCheck' : is not a member of 'CWnd'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\afxwin.h(1913) : see declaration of 'CWnd'
|
|
|
|
|
Why not break the code down into easier to read lines:
CButton* pButton = (CButton*)GetDlgItem(IDC_MY_RADIO1);
ASSERT(pButton != NULL);
if (pButton->GetCheck() == BST_CHECKED)
{
}
It always helps to breakdown the code.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
first, a made an error on the function, but someone else correct the mistake for me.
secondly, GetCheck() is a member of CButton, not CWnd...
if stdafx.h is included into your project, you shouldn't encounter such error (C2039).
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You are missing an open bracket at the start of the if statement.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|