首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ICU4C加速比函数

ICU4C加速比函数
EN

Stack Overflow用户
提问于 2020-05-16 13:06:20
回答 1查看 44关注 0票数 0

我正在尝试运行ICU4C bellow的代码演示程序,

警告:函数“自述”的隐式声明

然后生成一个错误。据我所知,这是因为缺少包含‘austr举’函数的导入库,并且一直在查看源代码来猜测它是哪一个,但没有运气。有人知道该进口哪一种吗?

代码语言:javascript
复制
#include <unicode/umsg.h>
#include <unicode/ustring.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main(int argc, char const *argv[])
{
    UChar* str;
    UErrorCode status = U_ZERO_ERROR;
    UChar *result = NULL;
    UChar pattern[100];

    int32_t resultlength, resultLengthOut, i;
    double testArgs[] = { 100.0, 1.0, 0.0};
    str=(UChar*)malloc(sizeof(UChar) * 10);
    u_uastrcpy(str, "MyDisk");
    u_uastrcpy(pattern, "The disk {1} contains {0,choice,0#no files|1#one file|1<{0,number,integer} files}");

    for(i=0; i<3; i++){
        resultlength=0; 
        resultLengthOut=u_formatMessage( "en_US", pattern, u_strlen(pattern), NULL, resultlength, &status, testArgs[i], str); 
        if(status==U_BUFFER_OVERFLOW_ERROR){ //check if output truncated
            status=U_ZERO_ERROR;
            resultlength=resultLengthOut+1;
            result=(UChar*)malloc(sizeof(UChar) * resultlength);
            u_formatMessage( "en_US", pattern, u_strlen(pattern), result, resultlength, &status, testArgs[i], str);
        }
        printf("%s\n", austrdup(result) );  //austrdup( a function used to convert UChar* to char*)
        free(result);
    }
    return 0;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-18 08:28:41

austrdup不是一种正式的ICU方法。它仅用于ICU中的测试,并在icu4c/source/test/cintltst/cintltst.h中定义并在icu4c/source/test/cintltst/cintltst.c中实现。基本上,它只是u_austrcpy的包装器。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61837244

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档