【发布时间】:2016-01-21 05:26:48
【问题描述】:
这是我的test file
这是我的完整代码 (github.com/roroco/ro_article/tree/string-contains-null-byte)
运行以下代码时,我得到“ArgumentError: string contains null byte”:
在红宝石方面:
get_article(File.read("test_file"))
在c端:
VALUE get_article(VALUE self, VALUE html) {
str html2 = StringValueCStr(html);
test file 这么大,如何在这个文件中找到空字节?以及如何使 StringValueCStr 适用于所有字符串,即使它包含“空字节”
【问题讨论】:
标签: c ruby ruby-c-extension