I am getting large (several MB) spreadsheets in txt form with way more information than I need. It is predictable. So I want to load up my input file, put the first line into an array of char
s, pick out the few relevant pieces into an output array, copy the output array to a separate output file, and loop through for each line in the input.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
char input[5459];
char output[1321] = { 0 };//initalize all values to 0
ifstream infile8;//input file
infile8.open("input.txt");
ofstream fout("output.txt");//output file
int i;
while (infile8.getline(input, sizeof(input))){
//cout << input[2] << " \n";
output[0] = input[18];//transaction status
//I select a bunch more info from the arrays here like above
i = 0;
while (i <= 1320){
fout << output[i];
i++;
}
fout << '\n';
//output = { 0 };//reset output file
}
return 0;
}
It currently never enters the loop.