Muss ich speicher wieder frei geben?
-
hi,
ich benutze hier diese methode aus der netzwerkprogrammierug
char * strIp; strIp = inet_ntoa(si_other.sin_addr);Muss ich jetzt am Ende noch ein free(strIp) machen oder wir der Speicher automatich wieder frei gegeben ?
-
Nein, musst bzw. darfst du nicht. Am besten benutzt du inet_ntoa gar nicht, sondern statt dessen inet_ntop.
-
http://www.google.de/search?hl=de&q=inet_ntoa&meta=lr%3Dlang_de|lang_en
=>
http://msdn.microsoft.com/en-us/library/ms738564(VS.85).aspxMSDN schrieb:
The inet_ntoa function takes an Internet address structure specified by the in parameter and returns a NULL-terminated ASCII string that represents the address in "." (dot) notation as in "192.168.16.0", an example of an IPv4 address in dotted-decimal notation. The string returned by inet_ntoa resides in memory that is allocated by Windows Sockets.
bb