说明:
指定应用程序的名字。应用程序可以从传递给CWinApp的构造函数的参数中得到,如果其中没有指定名字,则是ID为AFX_IDS_APP_TITLE的资源字符串。如果在资源中找不到应用程序的名字,那么它来自程序的可执行文件名。全局函数AfxGetAppName返回该值。m_pszAppName是const char* 类型的公有变量。
The _strdup function calls malloc to allocate storage space for a copy of strSource and then copies strSource to the allocated space.
就是分配目的串内存空间,然后将源字符串的内容copy到目的串中。(加一句,用完以后记得要free掉目的串的内存)
看看这个MSDN的例子就懂了:
// crt_strdup.c
#include <string.h>
#include <stdio.h>
int main( void )
{
char buffer[] = "This is the buffer text";
char *newstring;
printf( "Original: %s\n", buffer );
newstring = _strdup( buffer );
printf( "Copy: %s\n", newstring );
free( newstring );
}
输出:
Original: This is the buffer text
Copy: This is the buffer text