Max 5 API Reference
00001 #ifndef _EXT_STRINGS_H_ 00002 #define _EXT_STRINGS_H_ 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00008 00009 /** Copy the contents of one string to another, in a manner safer than the standard strcpy() or strncpy(). 00010 This is the prefered function to use for this operation in Max. 00011 @ingroup misc 00012 @param dst The destination string (already allocated) for the copy. 00013 @param src The source string that will be copied. 00014 @param size The number of chars allocated to the dst string. 00015 */ 00016 char *strncpy_zero(char *dst, const char* src, long size); 00017 00018 00019 /** Concatenate the contents of one string onto the end of another, 00020 in a manner safer than the standard strcat() or strncat(). 00021 This is the prefered function to use for this operation in Max. 00022 @ingroup misc 00023 @param dst The destination string onto whose end the src string will be appended. 00024 @param src The source string that will be copied. 00025 @param size The number of chars allocated to the dst string. 00026 */ 00027 char *strncat_zero(char *dst, const char* src, long size); 00028 00029 00030 /** Copy the contents of a string together with value substitutions, 00031 in a manner safer than the standard sprintf() or snprintf(). 00032 This is the prefered function to use for this operation in Max. 00033 @ingroup misc 00034 @param buffer The destination string (already allocated) for the copy. 00035 @param count The number of chars allocated to the buffer string. 00036 @param format The source string that will be copied, which may include sprintf() formatting codes for substitutions. 00037 @param ... An array of arguments to be substituted into the format string. 00038 */ 00039 int snprintf_zero(char *buffer, size_t count, const char *format, ...); 00040 00041 00042 #if TARGET_API_MAC_CARBON 00043 #define CtoPstr(x) CopyCStringToPascal((const char *)(x),(unsigned char *)(x)) 00044 #define PtoCstr(x) CopyPascalStringToC((ConstStr255Param)(x),(char *)(x)) 00045 #endif // TARGET_API_MAC_CARBON 00046 00047 00048 // Legacy 00049 00050 void ctopcpy(unsigned char *p1, char *p2); 00051 void ptoccpy(char *p1, unsigned char *p2); 00052 void setmem(void *s, long n, short b); 00053 void pstrcpy(unsigned char *p2, unsigned char *p1); 00054 00055 00056 #ifdef __cplusplus 00057 } 00058 #endif 00059 00060 #endif // _EXT_STRINGS_H_
Copyright © 2008, Cycling '74