ifstream

    4热度

    2回答

    我正在编写一个程序,它从文本文件中获取多个变量。 当程序找到EOF时, 它结束输入数据。 int main() { int val, count = 0; ifstream fileIn; fileIn.open("num.txt"); fileIn >> val; while (fileIn) { ++count;

    1热度

    1回答

    template <class T> void savetext(T *a, char const *b) //writes to text file inside .sln however the text file is corrupt { ofstream fout(b, ios::out); for (int i = 0; a[i] != '\0'; i++)

    -3热度

    1回答

    我被要求计算10名学生的平均分数。 首先,我能够从data.txt中文件看起来像这样读出和检索数据: 编号名称测试1的Test2 Test3的 1艾哈迈德58 97 83 2 Dollah 78 76 70 3拉梅什85 75 84 4 Maimunah 87 45 74 5罗伯特74 68 97 6库马尔77 73 45 7安顺56 23 27 8平74 58 18 9 Idayu 47 98

    0热度

    2回答

    我试图打开C++中的文本文件,并逐行读它,直到我找到一个特定的字符串,但该数据也被分成不同的部分... 该文本文件是这样的: entry_one:true,true,false; entry_two:true,false,false; entry_three:false,false,false; entry_four:true,false,true; 基本上,我需要阅读文本文件到内存中,

    0热度

    1回答

    我有一个简单的程序,试图将二维数据读入堆分配的浮点数组中。该计划如下。 #include <iostream> #include <fstream> void read_file(std::ifstream &inFile, float **arr, unsigned m, unsigned n) { for(unsigned i = 0; i < m; ++i) {

    0热度

    2回答

    我需要在使用ifstream加载的文件中导航。正确地说,我需要保存我以前的地方,以便在阅读几行后能够返回到这个确切的地方。 我想类似的东西: ifstream baseINTING("base.txt"); streampos position1, position2, position3; position1 = baseINTING.tellg(); 后来我读了几行字: getlin

    1热度

    1回答

    以下程序写入100个字节,但不会全部读回它们。为什么? #include <iostream> #include <random> #include <vector> #include <climits> #include <algorithm> #include <map> #include <fstream> #include <iomanip> int main() {

    1热度

    1回答

    我写尺寸3的载体,当我读得大小为4的矢量与上次指数为索引的一个重复2 我的继承人码。 void IOManager::WriteBin(const string &filename, vector<userRank> highScorers, int rank) { ofstream fsalida(filename, ios::out | ios::binary); if

    4热度

    1回答

    文件(SETTINGS.TXT)的端部不读新行的文件内容进行解析: FULLSCREEN=On V_SYNC=On [no "\n" at the end of file] 万一没有ENTER“\ n”个输出是: MapKey= FULLSCREEN MapValue= On MapKey= V_SYNC MapValue= Onřřřř 随着ENTER“\ n”的文件输出的到底是正

    4热度

    3回答

    我从文本文件中拉出数字并用它们填充int类型的数组。 我插入值到阵列,同时通过与这些代码行(其中,k是数字的.txt文件的量)的.txt文件循环: for (int j = 0; j < k; j++) inputFile >> tab[j]; 当数字在文本文件中小于2,147,483,647这是一个整数类型的最大尺寸一切顺利。 当这个数字大于这个数字时,我假定程序溢出并且未能插入它