|
|
发表于 2006-12-29 12:33:00
|
显示全部楼层
Re:Vista发布,.net编程时代来临,C++还有必要再精学么?
Argument Access
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for accessing arguments.
CRT function .NET Framework equivalent
va_arg, va_end, va_start System.ParamArrayAttribute class
Buffer Manipulation
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for buffer manipulation.
CRT function .NET Framework equivalent
_memccpy, memcpy, wmemcpy System.Buffer.BlockCopy, System.String.Copy
memchr, wmemchr System.String.CopyTo
memcmp, wmemcmp, _memicmp System.String.Compare, System.String.Equals
memmove, wmemmove System.Buffer.BlockCopy
memset, wmemset System.Buffer.SetByte
_swab Not applicable
Byte Classification
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for byte classification.
CRT function .NET Framework equivalent
isleadbyte, _ismbbalnum, _ismbbalpha, _ismbbgraph, _ismbbkalnum, _ismbbkana, _ismbbkprint, _ismbbkpunct, _ismbblead, _ismbbprint, _ismbbpunct, _ismbbtrail, _ismbslead, _ismbstrail, _mbbtype, _mbsbtype Not applicable, but see System.Globalization.CultureInfo
Character Classification
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for character classification.
CRT function .NET Framework equivalent
isalnum, iswalnum System.Char.IsLetterOrDigit
_ismbcalnum Not applicable
isalpha, iswalpha, _ismbcalpha, __isascii, iswascii System.Char.IsLetter
iscntrl, iswcntrl System.Char.IsControl
__iscsym, __iscsymf System.Char.IsSymbol
isdigit, iswdigit, _ismbcdigit System.Char.IsDigit
isgraph, iswgraph, _ismbcgraph Not applicable
islower, iswlower, _ismbclower System.Char.IsLower
_ismbchira Not applicable
_ismbckata Not applicable
_ismbclegal Not applicable
_ismbcl0, _ismbcl1, _ismbcl2 Not applicable
_ismbcsymbol Not applicable
isprint, iswprint, _ismbcprint Not applicable
ispunct, iswpunct, _ismbcpunct System.Char.IsPunctuation
isspace, iswspace, _ismbcspace System.Char.IsWhiteSpace
isupper, iswupper, _ismbcupper System.Char.IsUpper
iswctype Not applicable
isxdigit, iswxdigit System.Char.IsNumber
mblen Not applicable
Data Conversion
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for data conversion.
CRT function .NET Framework equivalent
abs, _abs64 System.Math.Abs
atof System.Convert.ToDouble
atoi System.Convert.ToInt32, System.Convert.ToUInt32
_atoi64 System.Convert.ToInt64, System.Convert.ToUInt64
atol System.Convert.ToInt64, System.Convert.ToUInt64
_ecvt System.Convert.ToString
_fcvt System.Convert.ToString
_gcvt System.Convert.ToString
_itoa, _i64toa, _ui64toa, _itow, _i64tow, _ui64tow System.Convert.ToString
labs System.Math.Abs
_ltoa, _ltow System.Convert.ToString
_mbbtombc Not applicable
_mbcjistojms, _mbcjmstojis Not applicable
_mbctohira, _mbctokata Not applicable
_mbctombb Not applicable
mbstowcs Not applicable
mbtowc Not applicable
strtod, wcstod System.Convert.ToDouble
strtol, wcstol System.Convert.ToInt64
strtoul, wcstoul System.Convert.ToUInt64
strxfrm, wcsxfrm, __toascii System.IFormattable.ToString
tolower, towlower, _mbctolower System.Char.ToLower
_tolower System.String.ToLower
toupper, towupper, _mbctoupper System.Char.ToUpper
_toupper System.String.ToUpper
_ultoa, _ultow System.Convert.ToString
wcstombs Not applicable
wctomb Not applicable
_wtoi Not applicable
_wtol Not applicable
Debug
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for debugging.
CRT function .NET Framework equivalent
_ASSERT, _ASSERTE System.Diagnostics.Debug.Assert
_CrtCheckMemory System.Diagnostics.PerformanceCounter
_CrtDbgReport System.Diagnostics.Debug.Write, System.Diagnostics.Debug.Writeline, System.Diagnostics.Debug.WriteIf, System.Diagnostics.Debug.WriteLineIf
_CrtDoForAllClientObjects Not applicable
_CrtDumpMemoryLeaks Not applicable
_CrtIsValidHeapPointer Not applicable
_CrtIsMemoryBlock Not applicable
_CrtIsValidPointer Not applicable
_CrtMemCheckpoint Not applicable
_CrtMemDifference Not applicable
_CrtMemDumpAllObjectsSince Not applicable
_CrtMemDumpStatistics System.Diagnostics.PerformanceCounter
_CrtSetAllocHook Not applicable
_CrtSetBreakAlloc Not applicable
_CrtSetDbgFlag Not applicable
_CrtSetDumpClient Not applicable
_CrtSetReportFile Not applicable
_CrtSetReportHook Not applicable
_CrtSetReportMode Not applicable
_RPT[0,1,2,3,4] Not applicable
_RPTF[0,1,2,3,4] Not applicable
_calloc_dbg Not applicable
_expand_dbg Not applicable
_free_dbg Not applicable
_malloc_dbg Not applicable
_msize_dbg Not applicable
_realloc_dbg Not applicable
Directory Control
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for directory control.
CRT function .NET Framework equivalent
_chdir, _wchdir System.Environment.CurrentDirectory
_chdrive System.Environment.CurrentDirectory
_getcwd, _wgetcwd System.Environment.CurrentDirectory
_getdcwd, _wgetdcwd System.Environment.CurrentDirectory
_getdrive System.Environment.CurrentDirectory
_mkdir, _wmkdir System.IO.Directory.CreateDirectory, System.IO.DirectoryInfo.CreateSubdirectory
_rmdir, _wrmdir System.IO.Directory.Delete
_searchenv, _wsearchenv Not applicable
Error Handling
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for error handling.
CRT function .NET Framework equivalent
_ASSERT, _ASSERTE Macros System.Diagnostics.Debug.Assert
clearerr Not applicable
_eof Not applicable
feof Not applicable
ferror Not applicable
_RPT, _RPTF Macros Not applicable
Exception Handling
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for exception handling.
CRT function .NET Framework equivalent
_set_se_translator Not applicable
set_terminate Not applicable
set_unexpected Not applicable
terminate Not applicable
unexpected See System.Exception Class
File-Handling Routines (File Descriptor)
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for file-handling using file descriptors.
CRT function .NET Framework equivalent
_chsize System.IO.Stream.SetLength, System.IO.FileStream.SetLength
_filelength, _filelengthi64 System.IO.Stream.SetLength, System.IO.FileStream.SetLength
_fstat, _fstat64, _fstati64 Not applicable
_isatty System.IO.Stream.CanWrite, System.IO.FileStream.CanWrite
_locking System.IO.FileStream.Lock
_setmode See System.IO.BinaryReader Class, System.IO.TextReader Class
File-Handling Routines (Path or File Name)
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for file-handling using paths or file names.
CRT function .NET Framework equivalent
_access, _waccess See System.IO.FileAccess enumeration
_chmod, _wchmod System.IO.File.SetAttributes, System.Security.Permissions.FileIOPermission
_fullpath, _wfullpath System.IO.File.Create
_get_osfhandle Not applicable
_makepath, _wmakepath System.IO.File.Create
_mktemp, _wmktemp Not applicable
_open_osfhandle System.IO.FileStream.Handle
remove, _wremove System.IO.File.Delete
rename, _wrename System.IO.File.Move
_splitpath, _wsplitpath Not applicable
_stat, _stat64, _stati64, _wstat, _wstat64, _wstati64 System.IO.File.GetAttributes, System.IO.File.GetCreationTime, System.IO.File.GetLastAccessTime, System.IO.File.GetLastWriteTime
_umask System.IO.File.SetAttributes
_unlink, _wunlink System.IO.File.Delete
Floating-Point Support
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for floating-point support.
CRT function .NET Framework equivalent
abs, _abs64 System.Math.Abs
acos, acosf System.Math.Acos
asin, asinf System.Math.Asin
atan, atanf, atan2, atan2f System.Math.Atan, System.Math.Atan2
atof, _wtof, atoi, _wtoi, _atoi64, _wtoi64, atol, _wtol System.Convert.ToInt64, System.Convert.ToUInt64, System.Convert.ToSingle, System.Convert.ToDouble
Bessel Functions Not applicable
_cabs Not applicable
ceil, ceilf System.Math.Ceiling
_chgsign Not applicable
_clear87, _clearfp Not applicable
_control87, _controlfp Not applicable
_copysign Not applicable
cos, cosf, cosh, coshf System.Math.Cos, System.Math.Cosh
difftime System.DateTime.Subtract
div Not applicable
_ecvt System.Convert.ToString
exp, expf System.Math.Exp
fabs, fabsf System.Math.Abs
_fcvt System.Convert.ToString
_finite System.Double.IsInfinity
floor, floorf System.Math.Floor
fmod, fmodf System.Math.IEEERemainder
_fpclass System.Double.IsInfinity, System.Double.IsNegativeInfinity, System.Double.IsPositiveInfinity, System.Double.IsNan
_fpieee_flt Not applicable
frexp Not applicable
_gcvt System.Convert.ToString
_hypot, hypotf Not applicable
_isnan System.Double.IsNan
labs System.Math.Abs
ldexp System.Math.Pow
ldiv Not applicable
log, logf System.Math.Log
log10, log10f System.Math.Log10
_logb Not applicable
_lrotl, _lrotr Not applicable
_matherr Not applicable
__max System.Math.Max
__min System.Math.Min
modf, modff Not applicable
_nextafter Not applicable
pow, powf System.Math.Pow
printf, wprintf System.Console.Write, System.Console.WriteLine
rand See System.Random Class
_rotl, _rotl64, _rotr_rotr64 Not applicable
_scalb Not applicable
scanf, wscanf System.Console.Read, System.Console.ReadLine
sin, sinf, sinh, sinhf System.Math.Sin, System.Math.Sinh
sqrt, sqrtf System.Math.Sqrt
srand See System.Random Class
_status87, _statusfp Not applicable
strtod, wcstod System.Convert.ToDouble
tan, tanf, tanh, tanhf System.Math.Tan, System.Math.Tanh
Input and Output
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for input and output.
CRT function .NET Framework equivalent
_open, _wopen, fopen, _wfopen, freopen, _wfreopen, _fsopen, _wfsopen System.IO.File.Open, System.IO.FileStream.FileStream
clearerr Not applicable
fclose, _fcloseall System.IO.FileStream.Close, System.IO.Stream.Close, System.IO.BinaryReader.Close, System.IO.BinaryWriter.Close, System.IO.TextReader.Close, System.IO.TextWriter.Close, System.IO.StringReader.Close, System.IO.StringWriter.Close, System.IO.StreamReader.Close, System.IO.StreamWriter.Close
_fdopen, _wfdopen System.IO.FileStream.FileStream
feof System.IO.FileStream.Read
ferror Not applicable
fflush System.IO.FileStream.Flush
fgetc, fgetwc System.IO.StreamReader.Read
_fgetchar, _fgetwchar System.Console.Read
fgetpos System.IO.FileStream.Position
fgets, fgetws System.IO.StreamReader.ReadLine, System.IO.TextReader.ReadBlock
_fileno System.IO.FileStream.Handle
_flushall System.IO.FileStream.Flush, System.IO.StreamWriter.Flush, System.IO.TextWriter.Flush, System.IO.BinaryWriter.Flush
fopen, _wfopen System.IO.File.Open
fprintf, fwprintf System.IO.StreamWriter.Write
fputc, fputwc System.IO.StreamWriter.Write
_fputchar, _fputwchar System.Console.Write
fputs, fputws System.IO.StreamWriter.Write
fread System.IO.FileStream.Read
freopen, _wfreopen System.IO.File.Open
fscanf, fwscanf System.IO.StreamReader.ReadLine; see also Parse methods, such as System.Double.Parse.
fseek System.IO.FileStream.Position, System.IO.FileStream.Seek
fsetpos System.IO.FileStream.Position
_fsopen, _wfsopen Not applicable
ftell System.IO.FileStream.Position
fwrite System.IO.FileStream.Write
getc, getwc System.IO.StreamReader.Read
getchar, getwchar System.Console.Read
gets, _getws System.Console.Read
_getw Not applicable
printf, wprintf System.Console.Write
putc, putwc System.IO.StreamWriter.Write
putchar, putwchar System.Console.Write
puts, _putws System.Console.Write
_putw Not applicable
rewind Not applicable
_rmtmp Not applicable
scanf, wscanf System.Console.ReadLine; see also Parse methods, such as System.Double.Parse.
setbuf Not applicable
_setmaxstdio Not applicable
setvbuf Not applicable
_snprintf, _snwprintf Not applicable
sprintf, swprintf System.String.Format
sscanf, swscanf See Parse methods, such as System.Double.Parse
_tempnam, _wtempnam, tmpnam, _wtmpnam Not applicable
tmpfile Not applicable
ungetc, ungetwc Not applicable
vfprintf, vfwprintf Not applicable
vprintf, vwprintf System.Console.Write
_vsnprintf, _vsnwprintf Not applicable
vsprintf, vswprintf System.String.Format
Internationalization
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for internationalization.
CRT Function .NET Framework Equivalent
setlocale, _wsetlocale see System.Globalization.CultureInfo Class
Memory Allocation
Because the common language runtime provides automatic memory management (garbage collection), the .NET Framework has no equivalents for the memory allocation functions in the C run-time library.
CRT function .NET Framework equivalent
_alloca, calloc, _calloc_dbg, _expand, _expand_dbg, free, _free_dbg, _get_sbh_threshold, _heapadd, _heapchk, _heapmin, _heapset, _heapwalk, malloc, _malloc_dbg, _msize, _msize_dbg, operator new, _query_new_handler, _query_new_mode, realloc, _realloc_dbg, _set_new_handler, _set_new_mode, _set_sbh_threshold Not applicable
Process and Environment Control
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for process and environment control.
CRT function .NET Framework equivalent
abort Not applicable
assert System.Diagnostics.Debug.Assert
_ASSERT, _ASSERTE Macros System.Diagnostics.Debug.Assert
atexit System.Diagnostics.Process.Exited
_beginthread, _beginthreadex System.Threading.Thread.Start
_cexit, _c_exit System.Diagnostics.Process.CloseMainWindow
_cwait System.Diagnostics.Process.WaitForExit
_endthread, _endthreadex Not applicable
_execl, _wexecl, _execle, _wexecle, _execlp, _wexeclp, _execlpe, _wexeclpe, _execv, _wexecv, _execve, _wexecve, _execvp, _wexecvp, _execvpe, _wexecvpe See System.Diagnostics.Process Class, System.Diagnostics.ProcessStartInfo Class
exit, _exit System.Diagnostics.Process.Kill
getenv, _wgetenv System.Environment.GetEnvironmentVariable
_getpid System.Diagnostics.Process.Id
longjmp Not applicable
_onexit System.Diagnostics.Process.Exited
_pclose Not applicable
perror, _wperror Not applicable
_pipe Not applicable
_popen, _wpopen Not applicable
_putenv, _wputenv Not applicable
raise Not applicable
setjmp Not applicable
signal Not applicable
_spawnl, _wspawnl, _spawnle, _wspawnle, _spawnlp, _wspawnlp, _spawnlpe, _wspawnlpe, _spawnv, _wspawnv, _spawnve, _wspawnve, _spawnvp, _wspawnvp, _spawnvpe, _wspawnvpe See System.Diagnostics.Process Class, System.Diagnostics.ProcessStartInfo Class
system, _wsystem See System.Diagnostics.ProcessStartInfo Class, System.Diagnostics.Process Class
Searching and Sorting
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for searching and sorting.
CRT function .NET Framework equivalent
bsearch System.Collections.ArrayList.BinarySearch
_lfind System.Collections.ArrayList.Contains
_lsearch Not applicable
qsort System.Collections.ArrayList.Sort
String Manipulation
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for string manipulation.
CRT function .NET Framework equivalent
mbscoll, _mbsicoll, _mbsncoll, _mbsnicoll System.String.Compare
_mbsdec, _strdec, _wcsdec Not applicable
_mbsinc, _strinc, _wcsinc Not applicable
_mbsnbcat Not applicable
_mbsnbcmp Not applicable
_mbsnbcnt, _mbsnccnt, _strncnt, _wcsncnt Not applicable
_mbsnbcpy Not applicable
_mbsnbicmp Not applicable
_mbsnbset Not applicable
_mbsnextc, _strnextc, _wcsnextc Not applicable
_mbsninc, _strninc, _wcsninc Not applicable
_mbsspnp, _strspnp, _wcsspnp Not applicable
sprintf, swprintf System.String.Format
strcat, wcscat, _mbscat System.String.Concat
strchr, wcschr, _mbschr System.String.IndexOf
strcmp, wcscmp, _mbscmp System.String.CompareOrdinal
strcoll, wcscoll, _stricoll, _wcsicoll, _strncoll, _wcsncoll System.String.Compare
_strnicoll, _wcsnicoll System.String.Compare
strcpy, wcscpy, _mbscpy System.String.Copy
strcspn, wcscspn, _mbscspn System.String.Substring
_strdup, _wcsdup, _mbsdup System.String.Clone
strerror, _strerror, _wcserror, __wcserror System.Exception.Message
strftime, wcsftime System.Convert.ToString
_stricmp, _wcsicmp, _mbsicmp System.String.Compare
strlen, wcslen, _mbslen, _mbstrlen System.String.Length
_strlwr, _wcslwr, _mbslwr System.String.ToLower
strncat, wcsncat, _mbsncat System.String.Concat
strncmp, wcsncmp, _mbsncmp System.String.Compare
strncpy, wcsncpy, _mbsncpy System.String.Copy
_strnicmp, _wcsnicmp, _mbsnicmp System.String.Compare
_strnset, _wcsnset, _mbsnset System.String.Replace
strpbrk, wcspbrk, _mbspbrk System.String.IndexOfAny
strrchr, wcsrchr, _mbsrchr System.String.LastIndexOf
_strrev, _wcsrev, _mbsrev Not applicable
_strset, _wcsset, _mbsset Not applicable
strspn, wcsspn, _mbsspn System.String.Substring
strstr, wcsstr, _mbsstr System.String.IndexOf
strtok, wcstok, _mbstok Not applicable
_strupr, _wcsupr, _mbsupr System.String.ToUpper
strxfrm, wcsxfrm Not applicable
vsprintf, vswprintf System.String.Format
System Calls
The following .NET Framework equivalents provide similar functionality of the C run-time library functions for system calls.
CRT function .NET Framework equivalent
_findclose Not applicable
_findfirst, _findfirst64, _findfirsti64, _wfindfirst, _wfindfirst64, _wfindfirsti64 System.IO.DirectoryInfo.GetFiles
_findnext, _findnext64, _findnexti64, _wfindnext, _wfindnext64, _wfindnexti64 Not applicable
Time Management
The following .NET Framework equivalents provide similar functionality of the C run-time library for time management.
CRT function .NET Framework equivalent
asctime, _wasctime System.DateTime.ToLongDateString, System.DateTime.ToLongTimeString, System.DateTime.ToShortDateString, System.DateTime.ToShortTimeString, System.DateTime.ToString
clock Not applicable
ctime, _ctime64, _wctime, _wctime64 System.DateTime.GetDateTimeFormats, System.DateTime.ToString, System.DateTime.ToLongTimeString, System.DateTime.ToShortTimeString
difftime System.DateTime.Subtract
_ftime, _ftime64 System.DateTime.Now
_futime, _futime64 System.IO.File.SetLastAccessTime, System.IO.File.SetLastWriteTime, System.IO.File.SetCreationTime
gmtime, _gmtime64 System.DateTime.UtcNow, System.DateTime.ToUniversalTime
localtime, _localtime64 System.DateTime.ToLocalTime
mktime, _mktime64 System.DateTime.DateTime
_strdate, _wstrdate System.DateTime.Parse
strftime, wcsftime, _strtime, _wstrtime System.DateTime.ToLongDateString, System.DateTime.ToLongTimeString, System.DateTime.ToShortDateString, System.DateTime.ToShortTimeString, System.DateTime.ToString
time, _time64 Not applicable
_tzset Not applicable
_utime, _utime64, _wutime, _wutime64 Not applicable
|
|