return ·¢Éú access violation ´íÎó - C/C++ / CÓïÑÔ
ÕâÊÇÎҵĴúÂëC/C++ code:
{
boolean bresult = FALSE;
AECHAR wMaoHao = ':';
AECHAR* waddress;
AECHAR* ptemp = NULL;
AECHAR* ptemp2 = accessAddress;
char* pstrtemp;
uint16 uport = 0;
ptemp = WSTRCHR(accessAddress, wMaoHao);
if (!ptemp)
{
*pwaddress = NULL;
*pwport = NULL;
return;
}
waddress = (AECHAR *) MALLOC( sizeof(AECHAR) * (ptemp - accessAddress + 1) );
if (waddress)
{
AECHAR * pa1 = waddress;
while(ptemp2 != ptemp)
{
*waddress = *ptemp2;
++ waddress;
++ ptemp2;
}
if (ptemp2 == ptemp)
{
*waddress = 0;
}
waddress = pa1;
}
pstrtemp = (char *) MALLOC( sizeof(char) * WSTRLEN( ++ptemp ) + 1 );
if (pstrtemp)
{
WSTRTOSTR(ptemp, pstrtemp, sizeof(char) * WSTRLEN( ptemp ) + 1);
uport = ATOI(pstrtemp);
}
*pwaddress = waddress;
*pwport = uport;
}
ΪºÎ Ò»µ½ return ¾Í²úÉú access violation ?
ÎÒÓõÄÊÇVC6.0
ÒÔÇ°ÔËÐÐÕâ¸öº¯ÊýµÄʱºòÒ²²»»á³öÏÖÕâÑùµÄ´íÎóµÄ¡£ÕâÊÇʲôÔÒòÄØ£¿{{-
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ͦ·±Ëö£¬Ö®Ç°·¢µÄÌû×Ó£¬·Öֵ̫µÍÏÖÔÚÖØ·¢Ò»¸ö¡£»¶Ó¸÷λ´óÏÀ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[] ......
¹«Ë¾¿ª·¢Ò»¸ö´¥ÃþÆÁ³ÌÐò£¬ÎÒ¸ºÔðµÄÒ»¿é£¬ÊµÏÖÕâÑùÒ»¸ö¹¦ÄÜ£¬µ±Êó±êµã»÷´°¿ÚÖÐͼƬ£¨Ò»ÕÅͼ·Ö³É¼¸²¿·Ö£©µÄÆäÖÐÒ»²¿·Öʱ£¬½«Õⲿ·ÖͼƬ½ØÈ¡³öÀ´£¬µ¯³öеĴ°¿Ú£¬½«½ØÈ¡³öµÄͼƬÏÔʾ³öÀ´¡£ÎÒʹÓÃRectangeÀà¿ØÖÆÁË·µ»Ø£¬ ......
ÎÒ¸Õ°ÑÌ·ºÆÇ¿µÄµÚÈý°æµÄÊéѧÍ꣬ÎÒÖªµÀµÄÓÐC++£¬CºÍÖ¸Õë CȱÏݺÍÏÝÚå Cר¼Ò±ä³É£¬»¹ÓÐÊý¾Ý½á¹¹£¬ÎÒÏëÎÊÎÊÎÒÓ¦¸ÃÒÔʲô˳ÐòÀ´Ñ§ÄØ
CȱÏݺÍÏÝÚå Cר¼Ò±à³Ì
Êǽø½×µÄ£¬²»Óü±×Å¿´
ÖÁÓÚ
CºÍÖ¸Õë
Äã²»Àí½âÖ ......