相关疑难解决方法(0)

我如何在C中进行base64编码(解码)?

我在unsigned char变量中有二进制数据.我需要将它们转换为c中的PEM base64.我查看了openssl库,但我找不到任何功能.有没有人有任何想法?

c base64

126
推荐指数
11
解决办法
27万
查看次数

为什么"dtoa.c"包含这么多代码?

我将是第一个承认我对低级编程的整体知识有点稀疏的人.我理解许多核心概念,但我不会定期使用它们.话虽如此,我对dtoa.c需要多少代码感到非常震惊.

在过去的几个月里,我一直在使用C#进行ECMAScript实现,而且我一直在减慢填充引擎中的漏洞.昨晚我开始研究Number.prototype.toString,它在ECMAScript规范(pdf)的15.7.4.2节中描述.在第9.8.1节中,注3提供了到dtoa.c的链接,但我正在寻找挑战,所以我等待查看它.以下是我提出的建议.

private IDynamic ToString(Engine engine, Args args)
{
    var thisBinding = engine.Context.ThisBinding;
    if (!(thisBinding is NumberObject) && !(thisBinding is NumberPrimitive))
    {
        throw RuntimeError.TypeError("The current 'this' must be a number or a number object.");
    }

    var num = thisBinding.ToNumberPrimitive();

    if (double.IsNaN(num))
    {
        return new StringPrimitive("NaN");
    }
    else if (double.IsPositiveInfinity(num))
    {
        return new StringPrimitive("Infinity");
    }
    else if (double.IsNegativeInfinity(num))
    {
        return new StringPrimitive("-Infinity");
    }

    var radix = !args[0].IsUndefined ? args[0].ToNumberPrimitive().Value …
Run Code Online (Sandbox Code Playgroud)

javascript c c# floating-point ecma262

19
推荐指数
3
解决办法
1万
查看次数

将float转换为字符串

如何在没有库函数的情况下将浮点整数转换为C/C++中的字符串sprintf

我正在寻找一个函数,例如char *ftoa(float num)转换num为字符串并返回它.

ftoa(3.1415)应该回来"3.1415".

c c++ floating-point

18
推荐指数
4
解决办法
6万
查看次数

标签 统计

c ×3

floating-point ×2

base64 ×1

c# ×1

c++ ×1

ecma262 ×1

javascript ×1