|
Hello Everyone,
In c++, when declaring objects using the default constructor why are we not allowed to use the parentheses?
For example:
Date birthday;
vs.
Date birthday(); // WRONG!!
It seems like allowing the parentheses would keep the syntax of the declaration in sync with when we are using a constructor other than the default such as
Date birthday(10, 4, 2000);
Seems like there is a reason for everything in c++ so just wondering.
Thanks.
|
|
|
|
|
yadrif wrote: Date birthday();
That's a declaration for function birthday that takes no parameters and returns a Date .
|
|
|
|
|
Thanks.
I get it now. I should have noticed that.
Thank You.
|
|
|
|
|
using the default constructor to use the parentheses
int i = int();
char c = char();
Data birthday = Data();
|
|
|
|
|
Hi All,
I'm compressing a range of bitmaps using the VCM and the ICCompress function that has been opened on the MP42 codec (Microsoft Mpeg4 V2). The compression of the bitmaps work just fine, but I am battling to set when the next keyframe should be delivered from the compression.
DWORD dwInFlags = 0, dwOutFlags = 0;<br />
<br />
if (various check to set a key frame)<br />
dwInFlags = ICCOMPRESS_KEYFRAME;<br />
<br />
<br />
m_lFrameCount++;<br />
<br />
DWORD dwSuccess = ICCompress(m_hIC, dwInFlags, (LPBITMAPINFOHEADER)m_pVideoOut, m_pFrame, (LPBITMAPINFOHEADER)m_pVideoIn, pFrame, NULL, &dwOutFlags, m_lFrameCount, 0, 0, NULL, NULL);<br />
<br />
if (dwSuccess == ERROR_SUCCESS)<br />
{<br />
if (dwOutFlags & AVIIF_KEYFRAME)<br />
{<br />
m_lFrameCount = 1;<br />
TRACE("\nKEYFRAME %d", m_pVideoOut->bmiHeader.biSizeImage);<br />
}<br />
<br />
Any ideas as to what may be wrong in my code, or is there another way to accomplish that ?
Thanks !
|
|
|
|
|
if i declare a class object to be static, like
static term terms[maxTerms];
what does that mean and what does that actually do?
btw does anybody have any idea how to solve 2 terms involving polynomials..i mean make a program that solves them? i only need a start on this..will think it through myself then..
|
|
|
|
|
|
|
|
Heh. I don't know what to tell you. Try google search on same text.
I usually post links to save myself typing....I can see that failed here...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
already tried google and the msdn library isnt opening
|
|
|
|
|
if you use Visual Studio, go to the Help index and type
"static members" and choose data members.
That's how I found the link.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm writing a program that can read out an C-file.
This is done line by line,
firt I open the file, then I read in every line of the file.
All these lines are putted in an Array,
now I have to search this array for functions, like "main", "void" etc.
So my question is,
How kan I search an array?
greetings,
Timo
|
|
|
|
|
That depends a lot of how you defined your array. A snippet of code would be usefull.
To search for a string into a larger string, you can use the strstr function[^]
|
|
|
|
|
Here's a couple of lines out of the code:
while ( fgets ( line, sizeof line, file ) != NULL )<br />
{<br />
rn++;
itoa(rn,regelnummer,10);
strcpy(alles[i], line);
i++;
strcpy(alles[i], regelnummer);
i++;
}<br />
fclose (file); <br />
}
........................................................
first the line out of a file is putted in the array,
after this the line number..
then the next line.. next line number etc..
|
|
|
|
|
So now all you have to do is go back through the alles array and look at all of the "even" lines. Use the strstr() function as has been mentioned.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What kind of array is that? Is it one dimensional like char sFile[SIZE] or two dimensional like char sLine[MAXLINES][MAXCHARS] ?
- NS -
|
|
|
|
|
i can compile and bulid my pgm sucusfully..
But when i run my pgm it says, "can't exectute" :
and when i press F5 it says, "..path\\release\mypgmname.exe not found"
y it happnes.. is there any anthing i can do to make it run??
|
|
|
|
|
suganforu wrote: and when i press F5 it says, "..path\\release\mypgmname.exe not found"
Does it actually exist?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
suganforu wrote: But when i run my pgm it says, "can't exectute" :
How are you executing it ? And what is the exact error message ?
suganforu wrote: and when i press F5 it says, "..path\\release\mypgmname.exe not found"
What kind of project is it ? A dll ? Or a plain executable ? Again, what is the exact message (with the correct path) ?
|
|
|
|
|
Use "Rebuild All..." in the menu and confirm if asked. Then use another time the "run" button.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
the error it shows .... " my file path\\Release\\mypgmname.exe" file not found....
i haven't used "Release file" in my pgm .. is there anything i could change in "project settings" ..? ?
|
|
|
|
|
when i rebulid all the follwing error happens....
" fatal error C1083: Cannot open precompiled header file: 'Release/acs.pch': No such file or directory"
same error in all my ".cpp" files..
|
|
|
|
|
By the way, if it displays two '\' then it means that you did something wrong in the configuration. For the path in the configuration, you should only supply one '\' (you will never have escape sequences in a path).
That is probably your problem.
|
|
|
|
|
@Cédric Moonen
noo that wasn't the problem...
|
|
|
|