1. How does C ++ define a fixed-length string? If the number of digits is not enough, fill in the string "0 "?
Eg:
Cstring str1 = "123 ";
If the number is less than 20 digits, add "0" to the previous step to achieve the effect of "00000000000000000123"
Answer:
Str. Format (_ T ("% 020 s"), _ T ("AAA "));
2. How can I hide the menu bar of a single document program created by vs2010?
Answer:
This is a single document of the MFC standard.
I don't know what type of single document you selected
Then, this is the cancelling method of the visucal studio style.
First, comment out this comment.
Then flip down...
Step 3!
OK finished
The last step is also the most critical step .. Kill his son!
Other methods:
Add pmainfrm-> setmenu (null) at the end of the app instantsh function, which is not necessarily valid. You can try it.
3. Test on the local machine that the Intranet IP address can be connected to the server, but the Internet IP address cannot be connected. Why?
Http://www.cctry.com/thread-242540-1-1.html
4. Use navigate for cdhtmldialog
Http://www.cctry.com/thread-242570-1-1.html
Http://www.cctry.com/thread-242623-1-1.html
Http://www.bccn.net/Article/kfyy/vc/jszl/200601/3003_2.html (the use of MFC browser customization and expansion)
5.
Cainiao-level question: about Char output
The Code is as follows. What I don't understand is:
1. Isn't the CH variable a whole? How can I output % C instead of ch? (I tried CH, but I added H to the result. Obviously, H is redundant.) This is a bit confusing,
2. ch is defined twice. The first is B, the second is E, and the output is: E. What is the purpose of defining B?
Program code: # include <stdio. h>
Int main (void)
{
Char CH = 'a ';
Ch = 'B ';
Ch = 'E ';
Printf ("% C \ n", CH );
Return 0;
} Answer:
Printf () is a ready-made function written in C, but it is not a component of C language. Its usage is defined by itself, not by C language. That is to say, do not take the usage of printf () as a C language, no!
Printf () functions are not intuitive, and misleading results are inevitable. What you encounter is a typical one. The format escape characters such as % C, % s, and % d may not be separated from the subsequent escape characters, and the readers may mistakenly think that they can generate meaningful output, it is especially confusing when the output string contains escape characters such as \. Unless you are familiar with various escape characters, it is easy to confuse. The output syntax modified by C ++ is better than that of C. When you come to other languages, you will naturally feel the simplicity of printf ()/scanf. You don't have to study the usage of such special functions, let alone the complicated usage. It is enough to learn the basics.
6. Today I saw a user at VC station studying how to implement left, mid, and right operations on strings in C.
Related posts see: http://www.cctry.com/thread-242625-1-1.html
//////////////////////////////////////// //////////////////////////////////////// //
// Note: This article from VC station: http://www.cctry.com
// Various learning resources such as C, C ++, and VC ++ are provided for free. We look forward to your participation!
//////////////////////////////////////// //////////////////////////////////////// //
The functions of these three functions are similar. Mid is intercepted from the center, left is intercepted from the left, and right is intercepted from the right.
As a result, I simply implemented it and provided it for your convenience.
- # Include <string. h>
- # Include <stdlib. h>
- Char * strleft (const char * SRC, unsigned int N)
- {
- If (! SRC | n <= 0 | n> strlen (SRC ))
- Return NULL;
- Char * retbuffer = (char *) malloc (n + 1 );
- Memset (retbuffer, 0, n + 1 );
- Strncpy (retbuffer, SRC, N );
- Return retbuffer;
- }
- Char * strmid (const char * SRC, unsigned int startidx, unsigned int N)
- {
- If (! SRC | startidx <0 | startidx> = strlen (SRC) | n <= 0 | n> = strlen (SRC ))
- Return NULL;
- Char * retbuffer = (char *) malloc (n + 1 );
- Memset (retbuffer, 0, n + 1 );
- Strncpy (retbuffer, SRC + startidx, N );
- Return retbuffer;
- }
- //////////////////////////////////////// //////////////////////////////////////// //
- // Note: This article from VC station: http://www.cctry.com
- // Various learning resources such as C, C ++, and VC ++ are provided for free. We look forward to your participation!
- //////////////////////////////////////// //////////////////////////////////////// //
- Char * strright (const char * SRC, unsigned int N)
- {
- If (! SRC | n <= 0 | n> = strlen (SRC ))
- Return NULL;
- Char * retbuffer = (char *) malloc (n + 1 );
- Memset (retbuffer, 0, n + 1 );
- Unsigned int offset = strlen (SRC)-N;
- Strncpy (retbuffer, SRC + offset, N );
- Return retbuffer;
- }
Because it is returned after malloc, do not forget free
8. In MFC, why is the problem syntax error: Missing '; 'before identifier 'mmversion ??
Is the type defined? include the header file. (In the opposite way)
9. If the edit box does not contain any input, the following button is unavailable. The input button is available. How can this problem be solved?
Remove the availability of the enablewindow () control when the edit box responds to the en_change event.
10. vs2010: an error is reported: Link: Fatal error lnk1123: failed during coff conversion: The file is invalid or damaged?
I installed vs 2010 on my computer. Today I downloaded vs 2012 and installed it. Then I created an MFC project and ran it. After opening the original vs 2010 Project, an error is reported: Link: Fatal error lnk1123: failed during coff conversion: The file is invalid or damaged.
First, explain the cause of the error (Microsoft's explanation), address: http://support.microsoft.com/kb/320216/zh-cn
Then, I found a lot of solutions on the Internet, and listed them as follows:
Method 1: the problem of embedded list is found, so the following operations are performed on the project and all dependent projects: right-click a project and choose "Project Properties"> "configuration properties"> "configuration tool"> "input" and "output"> "embedded List". Select "no".
You can also set the project \ properties \ configuration properties \ linker \ configuration file \ to generate a configuration: the original configuration is "yes" and changed to "no ".
Method 2: patch vs2010 with SP1. This patch has more than 500 mb. Yes: http://www.microsoft.com/en-us/download/details.aspx? Id = 23691
However, I tried to modify the patch according to method 1. So I downloaded the patch for two hours and found that the patch was okay after installation. I hope to give a reference to my friends who have encountered the same problem.