views:

51

answers:

1

I know that performing arithmetic on large integers in brainfuck, while perhaps quite tedious at times, is entirely possible.

However what I'm wondering about is what the generally acceptd best-practices are for taking in large integers (or even strings, I suppose) as input.

Most compilers/interpreters allow you to provide full strings at once as input (and then each character is read in individually with a ,). But what I'm wondering is this - how can you read one in if you don't know when the input stream is going to stop? I suppose one way is to tell the user to append a certain character/string of characters to their number to indicate that it's over, but that seems a bit non-user-friendly.

I'd prefer an answer that keeps portability in mind (implementation-specific solutions are of interest, but are not the primary focus of this question). If there is no completely implementation-agnostic way to do this, one that will work on most implementations and fail gracefully otherwise would be the next best thing.

Thanks in advance.

+2  A: 

Most languages let you read a line from input (e.g. gets() in C, ReadLine() in C# etc). Why not ask the user to enter each value as a line (i.e. separated by enter)?

Mau