在 OPENSTEP (YellowBox) 中将字符串写入磁盘

发布于 2024-09-25 18:25:46 字数 459 浏览 5 评论 0原文

我正在调试一个旧的 OPENSTEP (YellowBox) 应用程序,该应用程序用 Objective-C 编写,在 Windows 2000 上运行,使用 Project Builder 构建。我能找到的在 Obj-C 中将字符串写入磁盘的唯一简单方法是 [NSString writeToFile],这是一种 Cocoa/iOS 时代的方法,似乎尚未在该版本中编写我正在编译的 OPENSTEP(使用 Project Builder、YellowBox for Windows 1.0、v365)。

我基本上想在异常处理程序中将异常的详细信息写入磁盘(使用 NS_DURING..NS_HANDLER..NS_ENDHANDLER 块)。

编辑:

现在,我收到以下警告:'NSString'没有响应'writeToFile:'是否可能有其他原因(缺少#import 等)?

I'm debugging an old OPENSTEP (YellowBox) app, written in Objective-C, running on Windows 2000, built with Project Builder. The only easy way I can find to write a string to disk in Obj-C is [NSString writeToFile], a Cocoa/iOS-era method which doesn't seem to have been written yet in the version of OPENSTEP that I'm compiling against (using Project Builder, YellowBox for Windows 1.0, v365).

I'd basically like to write the details of an exception to disk in an exception handler (using an NS_DURING..NS_HANDLER..NS_ENDHANDLER block).

EDIT:

Right now, I'm getting the following warning: 'NSString' does not respond to 'writeToFile:' Is it possible that there's some other cause (missing a #import, etc.)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

热风软妹 2024-10-02 18:25:46

我认为 -writeToFile:* 在原始 OpenStep API 中可用。实际上,是的,至少有一个是(http://docs.sun.com/app/docs/doc/802-2112/6i63mn65q?l=Ja&a=view#05.Classes-243)。

无论如何,更糟的是,您可以使用 getString 方法来填充 malloc()ed 缓冲区,然后将其写入磁盘。

I thought -writeToFile:* was available as of the original OpenStep API. Actually, yes, at least one was (http://docs.sun.com/app/docs/doc/802-2112/6i63mn65q?l=Ja&a=view#05.Classes-243).

In any case, worse comes to worse, you could use the getString methods to fill a malloc()ed buffer then write that to disk.

筑梦 2024-10-02 18:25:46

我正在查看 WebObjects 4.0 (Project Builder v347.3) 中包含的适用于 Windows 的 Yellow Box 版本。有问题的方法的签名是 -writeToFile:atomically:,记录在 Apple 当前的开发者网站

我认为如果您使用此方法而不是仅使用 -writeToFile:,它会按预期工作。

I'm looking at the version of Yellow Box for Windows included in WebObjects 4.0 (Project Builder v347.3). The signature of the method in question is -writeToFile:atomically:, which is documented on Apple's current developer site.

I think if you had used this method instead of just -writeToFile:, it would work as expected.

萌能量女王 2024-10-02 18:25:46

如果 NSString 没有响应 writeToFile:,那么您的选择是将该方法添加到类中(您自己的实现),或者取出字符串并将其写入到一个文件(您自己的实现)。正如@bbum 所指出的,它不存在。 (嗨@bbum!)

If NSString does not respond to writeToFile:, then your choices are to either add that method to the class (your own implementation), or to get the string out and write it to a file (your own implementation). As @bbum indicates, it's not there. (Hi @bbum!)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文