首页 > 代码库 > VS使用技巧

VS使用技巧

1、VS中的正则

DCCircle *circle = new DCCircle(); =>
DCCircle *circle;
NEW_OBJ(circle,DCCircle());

\*{[:a_]*}:b*=:b*new:b+{.*\)}
\*{[:a_]*}:b*=:b*new:b+{.*};
*\1;NEW_OBJ(\1,\2)

circle = new DCCircle(); =>
NEW_OBJ(circle,DCCircle());

{[:a_]*}:b*=:b*new:b+{.*\)}
{[:a_]*}:b*=:b*new:b+{.*};
NEW_OBJ(\1,\2)

官方资料:http://msdn.microsoft.com/zh-cn/library/2k3te2cs(v=vs.90).aspx

2、linux上的vasprintf在windows上的替代

int vasprintf( char **sptr, const char *fmt, va_list argv )
{
int wanted = vsnprintf( *sptr = NULL, 0, fmt, argv );
if( (wanted > 0) && ((*sptr = (char*)malloc( 1 + wanted )) != NULL) )
return vsprintf( *sptr, fmt, argv );

return wanted;
}