Can you please tell me why this code prints garbage and loops forever.
I also have two questions:
using namespace std;
int main (int agrc, char* argv)
if (argv == NULL)
cout << "Usage: Profiler <file-name.c>" << endl;
file.open ("c:\258_assignment2\Profiling\ff.c", ios::in);
output.open ("output", ios::out);
while (!file.eof() )
c = file.get();
cout << c << endl;
output << c << endl;
1- how can i check if the file opened successfully?
2- i need to pass the argv to open as filename, but i get an error about wchar_t type. I ca't seems to pass char*. How can i solve this?