So I built an interpreter for a language I made, but I can't get the streams right. I have an istream pointer and if they don't supply a cmd line arg, it references the adress of cin, which works fine. however, if they do supply a file in the form of cmd line args, i want to make it reference an ifstream. how do i do that?
pointer = new std::ifstream(filename);
//Return control to caller notifying failure condition.
//Since pointer may point to std::cin, we need to know whether it's safe to delete it.
bool free_pointer = 1;