问题描述
首先:我真的很想将数组另存为.txt
文件。 .plist
没问题。
原因:之后,我想使用C ++将其保存到向量中。用包装器意识到这一点已经让我发疯了。
这是我的代码:
guard let buf = AVAudioPCMBuffer(pcmFormat: format!,frameCapacity: AVAudioFrameCount(file.length))
else{ throw NSError()}
try file.read(into: buf)
guard buf.floatChannelData != nil else{print("Channel Buffer konnte nicht erstellt werden")
throw NSError()}
let samples = Array(UnsafeBufferPointer(start:buf.floatChannelData![0],count:Int(buf.frameLength)))
var wData = Data(samples)
try! wData.write(to: outputURL())
但是无法使用Float值初始化数据吗?
如何将浮点值数组写入.txt
文件中?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)