Skip to content

02. How to write Hello World with fast_io?

cqwrteur edited this page Apr 28, 2024 · 1 revision

How to write Hello World with fast_io?

#include<fast_io.h>

int main()
{
	using namespace ::fast_io::io;
	print("Hello World\n");
}

It writes to C's FILE* stdout. We hacked the implementation of every libc to support this. The code is equivalent to

#include<fast_io.h>
#include<cstdio>

int main()
{
	using namespace ::fast_io::io;
	print(::fast_io::c_io_observer{stdout},"Hello World\n");
	//c_io_observer wraps the stdout to make fast_io works on stdio's FILE*.
}