Peng Yu writes:
> Hi,
>
>
https://github.com/facebookresearch/fastText/blob/master/src/fasttext.cc#L647
>
> At the above code, it does not allow stdin.
>
> if (args_->input == "-") {
> // manage expectations
> throw std::invalid_argument("Cannot use stdin for training!");
> }
>
> The relevant functions are the following. But I don't see which C++ I/O
> function can not be used with stdin. Does anybody see? Thanks.
For starters, stdin is a C library object. But that's neither here nor
there, since std::cin is C++ library's equivalent, that's available to be
used.
There must be some particular why this program cannot make use of std::cin,
and requires an actual file to be specified. You will have to figure out
what it is by reading the rest of the code and trying to understand it.
There could be many reasons. Perhaps the code requires a writable file, and
uses std::iostream, and std::istream, which is all that std::cin is, will
not be acceptable. Perhaps the code requires a seekable std::ifstream, and
the non-seekable std::istream will not work.
Or maybe one of several other, similar, reasons. You will need to read the
code and figure it out, if you want to.