在调用CC3200库函数开发中,调用UART_PRINT打印输出,想利用这个来查看输出的值的样式,,想问打印格式要满足什么要求??
Alvin Chen:
//***************************************************************************** // //!prints the formatted string on to the console //! //! \param format is a pointer to the character string specifying the format in //!the following arguments need to be interpreted. //! \param [variable number of] arguments according to the format in the first //!parameters //! This function //!1. prints the formatted error statement. //! //! \return count of characters printed // //***************************************************************************** int Report(const char *pcFormat, ...) {int iRet = 0; #ifndef NOTERMchar *pcBuff, *pcTemp;int iSize = 256;va_list list;pcBuff = (char*)malloc(iSize);if(pcBuff == NULL){return -1;}while(1){va_start(list,pcFormat);iRet = vsnprintf(pcBuff,iSize,pcFormat,list);va_end(list);if(iRet > -1 && iRet < iSize){break;}else{iSize*=2;if((pcTemp=realloc(pcBuff,iSize))==NULL){Message("Could not reallocate memory\n\r");iRet = -1;break;}else{pcBuff=pcTemp;}}}Message(pcBuff);free(pcBuff);#endifreturn iRet; }