Re: Tutorial
Chris Angelico <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CAPTjJmoTosB_SorH3zc235s6bigGrEis-JzT0USFE_AN4aaLag@mail.gmail.com> |
On Fri, Dec 9, 2016 at 3:32 AM, Peter Bortas <[email protected]> wrote: > Since I happened to have my Windows VM console up: I can confirm this > behavior in the default Hilfe: > >> Stdio.stdin->gets(); > foo > (1) Result: "foo\r" > > That seems rather useless. It would break the API to fix it, but on > the other hand gets() is one of those functions you almost only use in > tutorials. Would it break the API? I mean, conceptually, it's retrieving a string terminated by end-of-line. On Windows, "end-of-line" is often "\r\n". Perhaps the solution is for gets to always strip off a trailing \r? Bear in mind that this also applies to files that have CRLF endings, not just stdin. I normally get around it by trimming whites, but it'd be nice for it to just work. ChrisA