简体   繁体   English

在 C++ 中编写由缩进分隔的列文件文本

[英]Writing a columned file text separated by an indentation in C++

I'm trying to write in a file some numbers separated by an indentation (c++) so I can read them after using Python by numpy loadtxt function.我试图在文件中写入一些由缩进 (c++) 分隔的数字,这样我就可以在通过 numpy loadtxt 函数使用 Python 后读取它们。 What is the most effective way to add an indentation in C++?在 C++ 中添加缩进的最有效方法是什么? I might think a comma should work too.我可能认为逗号也应该起作用。 This is what I have (not separated):这是我所拥有的(未分开):

    ofstream qfit ;
    qfit.open("qfit.dat") ;
    qfit << freq_si <<star.mom_quad() << star.angu_mom() ;
    qfit.close();

Add a '\\t' or change the delimiter.添加 '\\t' 或更改分隔符。 By @NathanOliver通过@NathanOliver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM