 |
|
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers, Chris Maunder
The Code Project Co-founder Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 4.12/5 |
|
|
|
 |
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers, Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
| Sign In·View Thread·PermaLink | 3.84/5 |
|
|
|
 |
|
 |
hi every body.....
i have a small problem in my application.......
record and save a voice message(or)file using our application.
please help me
thanks in advace...
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
|
 |
|
 |
Hello Sir
This is my source code when i compiled this , its showing some errors ..but i think the code was correct.
this is my source
#include "stdafx.h" #include <iostream> using namespace std; int main(int argc, _TCHAR* argv[]) { static int x __asm("x") = 5; __asm( "mov eax, x;" "shr eax,1;" "mov x, eax;" ); cout<<x<<endl; return 0; }
error C2143: syntax error : missing ';' before '__asm' error C2400: inline assembler syntax error in 'opcode'; found '(' error C2400: inline assembler syntax error in 'opcode'; found '(' error C2059: syntax error : ')'
Please Replay !!
Thanks!!
Raju !!!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I'm not an expert on that field, but I think you should write it this way instead:
__asm { mov eax, x; shr eax,1; mov x, eax; }
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi All, I m building my solutions through command line (devenv.exe). But the problem is that if build for any project gets failed the script keep running and dosen't stop.How is it possible that i can stop the build file as soon as any error in any project or solution occurs.
Thanx a lot in advance.
It's not enough to be the best, when you have capability to be great....
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
When building, you may use Ctrl+Break to stop it. If you are building using a command line(console), Ctrl+C 
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I m not going to sit and watch are there any error every time (since it's used for continuous integration ) i want something that should stop on it's own.
It's not enough to be the best, when you have capability to be great....
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | array   myJelly | 2hrs 13mins ago |
|
|
 |
|
 |
You may find a lot of examples in any good C tutorial or book (even in bad ones, actually...).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke [My articles]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
 | hi!!   emjie | 2hrs 13mins ago |
|
|
 |
|
|
 |
|
 |
Have a look at
http://msdn.microsoft.com/en-us/library/ts4c4dw6.aspx http://www.cplusplus.com/doc/tutorial/arrays/
G.Paulraj
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I create a new MFC class which derived from CEdit Ctrl with the WM_NCPAINT() message. I do nothing in OnNcPaint() method(But I want to do something in it). The Edit control has style of multiline, horizontal , vertical scroll. The scroll bars both are visible if I input enough character . But the problem is that if the edit control redrawed, the scroll bars both are invisible unless I input the character again. How can I keep the scroll bars visible all the time? Thanks in advance.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
HI all
I am Having list control with datas.
I need for every column a particular item need to coloured...The column can be varied
Kindly help me on this.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
Hi, I allocated a struct from a heap, the struct may be like this one:
struct abc{ int tmp1; string tmp2; int tmp3; }*pabc;
pabc=(abc*)malloc(sizeof abc);
And when I initialize the string(pabc->tmp2="1234"), an "Illegal Pointer" exception occured. It seems that the size of the string is changed, so I decided to allocate a bigger size.
pabc=(abc*)malloc(sizeof abc+4);
But the error still exists. sizeof(string("1234")) seems to be 8 instead of 4.
Can anyone help me with this problem?
modified on Sunday, November 22, 2009 11:46 PM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
tyftyftyf wrote: abc->tmp2="1234"
Shouldn't this be pabc->tmp2="1234"
sizeof(string) will give you the size of the internal pointers/counters maintained by the string class. To get the size of the string use its size() method.
modified on Sunday, November 22, 2009 10:42 PM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I'm really sorry i mistyped this. And the problem is probably solved by using a pointer to string instead of the string itself.
But I'm still confused about the size problem, for example, a string with 4 characters actually use 8 bytes in memory.Maybe a string contains other parameter variables, not just pure characters.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
 |
I see, the string probably itself has a pointer to an array of char. And I solve the problem by adding: memset(pabc,0,sizeof(abc));
I realized when using malloc, the memory is not cleared, so the pointer inside the string architect is just a mess, but when setting a value for string, the program found the string struncture is not all zero and considered that the string is already initialized so the program just change the value of the array of char that pointer pointed to.Ofcourse that pointer is just a mess, so "illegal pointer" occured.
If I clear the memory first, the pointer is just zero, so program will initialize it first.
Forgive my poor english....
Thanks!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
As Superman mentioned sizeof(string) returns size of string class and it will return 16 for ANSI and 32 for UNICODE. In your structure one of a member is a string and you do not know what string size would be until you assign a characters to it.
You are also facing another issue, that you have probably experience. Assigning string to member of pabc structure will cause exception, since you are merely reserving block of memory (including memory for a string) and as a result string member of the abc is not initialized because string constructor is never called.
There is remedy for that but...
pabc = (abc*)malloc(sizeof abc); memcpy(&pabc->tmp2, &string(), sizeof(string)); pabc->tmp2 = "1234***************************";
Much better and safer is to allocate memory on the heap is to use "new" operator. This will assure that string’s constructor is called and string is properly initialized
memcpy(&pabc->tmp2, &string(), sizeof(string)); pabc->tmp2 = "1234***************************"; Much simpler. Out of curiosity if you are using MFC why using std string instead of CString class?
JohnCz MS C++ MVP
modified on Monday, November 23, 2009 12:51 AM
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
I see, I should copy a constructed null string first right? I used malloc because I was dealing with a multi-thread program, the thread which allocated and initialized the structure will die far before the structure is useless and should be deleted.So I'm consider using one thread allocate it, and another thread dispose it.
But C++ only allow "new" operator disposing a memory from a thread's local heap.So I used Windows API HeapAlloc and HeapFree, those two can allow two threads allocate and dispose memory from a same heap.
Then I encountered this initializing string problem.To make the code simpler, I wrote malloc instead of HeapAlloc, afterward I found out that these two are almost the same in single thread mode.
I guess I'm still just a beginner in C++.
ps: That program is a console, not MFC. I'd like to use BCB to design GUI. I'm still pretty confused about Windows Messages.
Thanks a lot.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
hi,i would like to ask.. if the running time of java programs was more difficult to analyze,than c programs????
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |