| Deutsch English Français Italiano |
|
<vmv082$1u6pm$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: "Paul Edwards" <mutazilah@gmail.com> Newsgroups: comp.lang.c Subject: C90 fpeek Date: Fri, 24 Jan 2025 14:08:44 +1100 Organization: A noiseless patient Spider Lines: 42 Message-ID: <vmv082$1u6pm$1@dont-email.me> Injection-Date: Fri, 24 Jan 2025 04:08:50 +0100 (CET) Injection-Info: dont-email.me; posting-host="fda4a84c3bda6e185fc69fc9e52e89a8"; logging-data="2038582"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18v5sm9W/QWv0hWy0WofnCnnwbfoZOBXBc=" Cancel-Lock: sha1:GimX+ly+W+SgJN63qyOGCCibmUc= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-Priority: 3 X-MSMail-Priority: Normal Bytes: 2426 I am able to open COM1: with C90 fopen and do a zmodem file transfer on the stream. So long as it is an error-free environment, I can switch between reading and writing so long as I do the C90-required fseek. I simply fseek by 0 from SEEK_CUR. However, if there is line noise, it is unpredictable when there will be a NAK coming down the line. So what I would like to do is fseek of 0, then fpeek(stream), and if it says there is data available, I read it. On streams where peeking is not available, it does an appropriate return, and I rely on it being an error-free environment (as now, ie I'm no worse off). With the benefit of hindsight, is there any reason why fpeek couldn't have been added to C90, with implementations being allowed with just a macro that returns some sort of "unsupported"? If fpeek (or similar) makes sense, can someone suggest an appropriate interface? Before sending a NAK I probably want to do an fdiscard of the input stream too. But again with no guarantees that the data will be discarded, and my protocol needs to allow for that. Thanks. Paul. P.S. zpg.zip (z/PDOS-generic) from https://pdos.org is now self-hosting - gccmvs (gcc 3.2.3) can rebuild itself, byte-exact. It runs under Hercules/380 (herc32.zip or herc64.zip) and microemacs is provided too. This is for an IBM mainframe and it uses EBCDIC (including a FAT32 file system in EBCDIC). I'm starting preparations to dial a BBS (using Virtualbox to link COM1 to an IP address) to talk to the world.