What we get from visiting the VC station today

Source: Internet
Author: User

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.

  1. # Include <string. h>
  2. # Include <stdlib. h>
  3. Char * strleft (const char * SRC, unsigned int N)
  4. {
  5. If (! SRC | n <= 0 | n> strlen (SRC ))
  6. Return NULL;
  7. Char * retbuffer = (char *) malloc (n + 1 );
  8. Memset (retbuffer, 0, n + 1 );
  9. Strncpy (retbuffer, SRC, N );
  10. Return retbuffer;
  11. }
  12. Char * strmid (const char * SRC, unsigned int startidx, unsigned int N)
  13. {
  14. If (! SRC | startidx <0 | startidx> = strlen (SRC) | n <= 0 | n> = strlen (SRC ))
  15. Return NULL;
  16. Char * retbuffer = (char *) malloc (n + 1 );
  17. Memset (retbuffer, 0, n + 1 );
  18. Strncpy (retbuffer, SRC + startidx, N );
  19. Return retbuffer;
  20. }
  21. //////////////////////////////////////// //////////////////////////////////////// //
  22. // Note: This article from VC station: http://www.cctry.com
  23. // Various learning resources such as C, C ++, and VC ++ are provided for free. We look forward to your participation!
  24. //////////////////////////////////////// //////////////////////////////////////// //
  25. Char * strright (const char * SRC, unsigned int N)
  26. {
  27. If (! SRC | n <= 0 | n> = strlen (SRC ))
  28. Return NULL;
  29. Char * retbuffer = (char *) malloc (n + 1 );
  30. Memset (retbuffer, 0, n + 1 );
  31. Unsigned int offset = strlen (SRC)-N;
  32. Strncpy (retbuffer, SRC + offset, N );
  33. Return retbuffer;
  34. }

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.