Hi,
After many many hours of agonising debugging, I've found I need to declare one of my input streams globally.
I'm loading up a .txt file and need to have 2 functions have access to it. I would rather pass a pointer (to the stream) to my function but I'm not very confident the pointers and my brain has been jellyfied.
So any tips on how to declare it globally, so far I have:
Code:
void function()
{
char ch;
ifstream instream(buffer);
instream.get(ch);
switch(process_stream(ch))
{
case 1:
case 2:
case 3:
}
}
Code:
int process_stream(char ch)
{
string word;
while(instream.get(ch) && isalnum(ch))
{
word += ch;
}
return identifier(word);
}
Any help for either method would really, really be appreciated
Pete C