Print without using Stdio in C++

C++ Program to print a line without using stdio. Here we are using the low level features in C++ to Achieve that. This Program will interrupts the kernel manually to write to standard output.

Source code :

void print(char const * msg, long length) {
	asm("movq $4, %%rax\n\t"
		"movq $1, %%rbx\n\t"
		"movq %0, %%rcx\n\t"
		"movq %1, %%rdx\n\t"
		"int $0x80"
		: "r" (msg), "r" (length)
		: "%rax", "%rbx", "%rcx", "%rdx");

int main() {
	print("Hello world!\n", 13);
	return 0;

Output :

Hello world!

Output :


Comments :