Terminality
Terminality copied to clipboard
Ability to send EOF signal
nt.
Terminallity is not aims to be terminal emulator so this feature will not be implemented. However, EOF signal can be implemented in the Terminality so I will leave this issue as an enhancement on EOF signal.
I am writing something like
#include <bits/stdc++.h>
using namespace std;
struct fastIO {
static const int BUF_SIZE = 1 << 15;
char inbuf[BUF_SIZE];
char outbuf[BUF_SIZE];
int incur, outcur;
FILE *in, *out;
fastIO():incur(BUF_SIZE),outcur(0),in(stdin),out(stdout) {}
fastIO(const fastIO &iio):incur(BUF_SIZE),outcur(0),in(iio.in),out(iio.out) {}
~fastIO() {close();}
inline fastIO &operator=(const fastIO &iio) {incur = (BUF_SIZE),outcur = (0),in = (iio.in),out = (iio.out);return *this;}
inline char getchar() {if (incur == BUF_SIZE) {fread(inbuf, BUF_SIZE, 1, in);incur = 0;}return inbuf[incur++];}
inline void getstr(char *str) {*str = getchar();while(!isgraph(*str))*str = getchar();while(isgraph(*str))*++str = getchar();*str = 0;}
inline int getint() {int x = 0;char c = getchar();while (!isdigit(c))c = getchar();while (isdigit(c)) {x = x * 10 + c - '0';c = getchar();}return x;}
inline void putchar(char ch) {outbuf[outcur++] = ch;if (outcur == BUF_SIZE) {fwrite(outbuf, BUF_SIZE, 1, out);outcur = 0;} }
inline void putint(int x) {if(x<0)putchar('-'),x=-x; if (x >= 10) putint(x / 10);putchar(x % 10 + '0');}
inline void putstr(const char *x) {while(*x)putchar(*x++);}
inline void putendl() {return putchar('\n');}
inline void close() {if (outcur > 0) fwrite(outbuf, outcur, 1, out);outcur = 0;}
} io;
int main(int argc, char const *argv[])
{
int x = io.getint();
io.putint(x);
io.putendl();
return 0;
}
but it doesn't work because fread
reading need a EOF signal to end a reading. How should I do?
@spywhere