0

I'm basically trying to create a program that will read through an assembly file's content and output the instruction line by line. In a nutshell, the Preprocessor() function would skip the instruction line if the instruction starts with a semicolon (which is the keyword to start a comment), and it also skips if the line has a null ASCII value of 0. If the line starts with a whitespace character, remove it. That's basically the gist of it so far.

class FETCH {
    private:
        std::string Preprocess(std::fstream filestream, std::string line, bool verbose) {
            while(getline(filestream, line)) {
                if (line[0] == ';') { continue; }
                if ((int)line[0] == 0) { continue; }
                if (std::isalpha(line[0])) { std::cout << "true" << std::endl; }
                if (isspace(line[0])) {
                    int length = line.length();
                    int spaceCount;

                    for (int i = 0; i < length; i++) {
                        if (isspace(line[i])) {
                            spaceCount++;
                        } else {
                            break;
                        }
                    }

                    line = line.substr(spaceCount);
                    spaceCount = 0;
                }


                // more preprocessing to be added...


                if (verbose == true) {
                    std::cout << line << "\n";
                    std::cout << "======================" << "\n";
                }
            }
            return line;
        }

    public:
        // Get the line of code
        void FetchLine(void) {
            std::fstream file;

            // Open the file
            file.open("src/cycle/test2.asm", std::ios::in);
            if (file.is_open()) {
                std::string line;
                Preprocess(file, line, false);
                file.close();
            }
        }
} FETCH;

However on line 45, the Preprocessor() gives me an error, (specifically it's underlined in the file parameter) saying:

function "std::basic_fstream<_CharT, _Traits>::basic_fstream(const std::basic_fstream<_CharT, _Traits> &) [with _CharT=char, _Traits=std::char_traits<char>]" (declared at line 1109 of "/usr/include/c++/11/fstream") cannot be referenced -- it is a deleted functionC/C++(1776)
Existentialist
  • 177
  • 2
  • 9

0 Answers0