mukel
February 18, 2013, 5:33am
1
Any hints or improvements are welcome.
This is a cin/cout (very) fast replacement. This redefines cin/cout so, just include this code to boost I/O speed, and everything should work like cin/cout.
Output only works fast when ONLINE_JUDGE is defined, else it flushes constantly, which is desirable when code is tested locally.
Voila le code: [Fast IO][1]
[1]: http://ideone.com/fOK6CW
11 Likes
Pity the Markdown vandalizes the _'s used in the code I guess people would just have to copy-paste from the āeditā option.
mukel
February 18, 2013, 5:50am
3
FIXED: Link to code is provided.
1 Like
wicked :Dā¦ had an enjoyable moment reading this codeā¦ cool
1 Like
@mukel I am implementing this code but I am getting An error that i am not able to understand. Can you help? http://ideone.com/Ke9Y42 here is the link
mukel
March 19, 2013, 7:13pm
6
Fixed #includes issue and link updated. Any feedback, extension or even some shrinked version is apreciated, enjoy
lxfind
March 20, 2013, 2:40am
7
Very cool!!!
A small suggestion:
It shall be better to change the following line:
inline IO& operator << (char * s) { while (*s) putChar(*s++); return *this; }
into:
inline IO& operator << (const char * s) { while (*s) putChar(*s++); return *this; }
Otherwise there can be compiler warnings when output constant strings like: cout << " ";
mukel
March 20, 2013, 5:16am
8
Done, + added very basic usage example, enjoy!!!
mukel
March 22, 2013, 3:19am
9
Fixed bug with sign, + little improvement reading signed integers. Tested on SPOJ INTEST problem.
Can you please help me, Iām trying to compile your code on Windows, Iām using Code::Blocks(gnu gcc compiler) and Iām getting next warnings: āgetc_unlockedā was not declared in this scope , āputc_unlockedā was not declared in this scope
rvns03
February 10, 2015, 7:36pm
12
Not sure if it is a bug. But when I have 2 space-separated characters in stdin like,
STDIN
a b
and MY CODE is
char x,y;
cin>>x>>y;
x stores āaā and y stores ā ā where it should avoid spaces and store ābā (since it emulates cin).
Otherwise, itās a charm
this does not work on codeforces , why is it so?
this does not work on codeforces , why is it so?