I'm currently using Clion for a school project that involves creating an assembler for MIPS. I've been trying to test it, but my ifstream.open() is failing to find the text file that is in the same folder as the program. I am using the same exact code to open my file as I did in previous projects, literally copy pasted, and for whatever reason it isn't working. I don't need help with any other issues in the program, I can fix those bugs on my own, but this file business, which I'm assuming has something to do with clion being a pain, makes me wanna pull my hair out.
I have tried declaring my istream as istream and ifstream, as well as inputting the file name, as well as the whole filepath from C: all the way to the file.
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
#include <fstream>
#include <array>
using namespace std;
//void GrowArrays(int &size, int *intArray, string *stringArray);
bool RegisterCheck(string &binary, string hold);
int main() {
string fileName;
string binaryOut;
string outFileName;
string tempString;
string holdString;
int holdInt;
int binaryHold[16];
int arraySize = 0;
string labels[arraySize] = {};
int labelAddress[arraySize] = {};
string stringTemp[arraySize];
int tempInt[arraySize];
int binaryCounter;
int instructionCounter = 0;
ifstream fin;
ifstream fint;
cout << "Please input the name of the file you wish to open";
cin >> fileName;
cout << "please input the name of the file you wish to write to.";
fin.clear();
fint.clear();
fin.open(fileName);
fint.open(fileName);
while(!fin) {
cout << "File not opened, try again.";
cin >> fileName;
fin.open(fileName);
fint.open(fileName);
}
` `//not making it to rest of program after this
should open the file and continue on in the program, but gets stuck in the loop because file is failing to be opened