smol_mazunki 2022-07-30 10:52:17
alexmb7 2022-07-30 10:52:13
at end is clear
no.
alexmb7 2022-07-30 10:52:18
at finishing reading
smol_mazunki 2022-07-30 10:52:20
that’s the problem
alexmb7 2022-07-30 10:52:28
its imho so
alexmb7 2022-07-30 10:52:33
.. but explain ..
alexmb7 2022-07-30 10:52:38
say
K11M1 2022-07-30 10:52:38
Well if EOF is sent then you will know
smol_mazunki 2022-07-30 10:52:38
C doesn’t know when the stream ends
K11M1 2022-07-30 10:52:47
smol_mazunki 2022-07-30 10:52:38
C doesn’t know when the stream ends
It should know that
alexmb7 2022-07-30 10:52:51
yes eof is sent
alexmb7 2022-07-30 10:52:55
by end of pipe
K11M1 2022-07-30 10:52:59
Yep
smol_mazunki 2022-07-30 10:53:06
if you read 1024 characters at once that’s a problem then
alexmb7 2022-07-30 10:53:11
but else i select, and react, and math lens together
smol_mazunki 2022-07-30 10:53:14
you have to check each 1024 characters if there’s an EOF
K11M1 2022-07-30 10:53:14
smol_mazunki 2022-07-30 10:53:06
if you read 1024 characters at once that’s a problem then
Why?
alexmb7 2022-07-30 10:53:16
no read
alexmb7 2022-07-30 10:53:17
select
K11M1 2022-07-30 10:53:30
smol_mazunki 2022-07-30 10:53:14
you have to check each 1024 characters if there’s an EOF
You don’t have to do that, function already sends you how much it read
alexmb7 2022-07-30 10:53:39
afik read returns read elements,
alexmb7 2022-07-30 10:53:48
i mean count
alexmb7 2022-07-30 10:53:49
len
K11M1 2022-07-30 10:53:52
Yep
smol_mazunki 2022-07-30 10:53:53
K11M1 2022-07-30 10:53:30
You don’t have to do that, function already sends you how much it read
oh, huh
smol_mazunki 2022-07-30 10:53:54
magic
alexmb7 2022-07-30 10:54:00
luul
alexmb7 2022-07-30 10:54:06
we’re on it
K11M1 2022-07-30 10:54:13
Without this function streams would be impossible to handle
smol_mazunki 2022-07-30 10:54:22
K11M1 2022-07-30 10:54:13
Without this function streams would be impossible to handle
i just check for NUL XD
alexmb7 2022-07-30 10:54:26
with biggest luck i wont skip the idea its just my .c basics are crapp
K11M1 2022-07-30 10:54:36
You just don’t know it before hand
alexmb7 2022-07-30 10:54:44
ye
alexmb7 2022-07-30 10:54:53
becomes known at processing
K11M1 2022-07-30 10:55:12
And was is the big problem anyway?
smol_mazunki 2022-07-30 10:55:13
so the gist is: “ask for 1024 bytes to read()… then check how much was copied, and then fwrite up to max(1024, how_much_was_read)”