0
float process(float Beta, std::ifstream & INPUT, float mass, float energy, int Juse = 1, int Jerror = 1, int intype = 1)
{
    float crosscons = 8 * M_PI * mass * mass / energy; //Creates a constant that is used to calculate the cross section

    int dwarf_count = 0;
    int dcol = 0;
    string line;
    string item;
    int header = 0;
    string skip("#");
    INPUT.seekg(0, ios::beg);
    while (getline(INPUT, line)) {
        if (contains(line, skip))
        {
            header++;
        } else {
            break;
        }
    }

This first bit I know it's reading a file, but I have no idea where it's reading the file or where it gets it from. Inside the function I know it's trying to skip to the data because it looks like the file is filled with # I'm really new to C++ so i'm sorry if this really simple and stupid. Anything helps thanks!

Enrique92
  • 55
  • 6
  • 2
    `INPUT` is passed into the function as an already open file. You'd need to look where `process` is being called from. Can't comment on code I can't see. Consider a [mcve]. – Retired Ninja Jan 26 '21 at 02:08
  • Start with `std::ifstream & INPUT` and go from there. [Decent books](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) and [references](https://en.cppreference.com/w/cpp) helps. – Some programmer dude Jan 26 '21 at 02:08
  • Short answer - you're looking in the wrong place. This code doesn't care where the file is. – Drew Dormann Jan 26 '21 at 02:15

1 Answers1

0

I have no idea where it's reading the file

The call to INPUT.seekg() is seeking the INPUT stream's read pointer to the beginning of the file, and then the getline() loop is reading individual lines of text from the stream until the end of the stream is reached, or a line not containing # is found, whichever occurs first.

or where it gets it from

The process() is getting the INPUT stream from the caller as an input parameter. Where the caller is getting the stream from, we can't answer that, as there is not enough code shown. You need to look at the code that is calling process() to know where the INPUT stream is coming from.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770