How to use _fputc_nolock() to write characters to stdout without locking in C

1 Answer

0 votes
#include <stdio.h>

int main(void)
{
	char str[] = "C Programming\n";
	char* p;

	p = str;
	
	// int _fputc_nolock(int c, FILE* stream);
	// _fputc_nolock - not protected from interference by other threads

	while ((*p != '\0') && _fputc_nolock(*(p++), stdout) != EOF);

	return 0;
}




/*
run:

C Programming

*/

 

 



answered Apr 27, 2024 by avibootz

Related questions

1 answer 203 views
1 answer 237 views
1 answer 98 views
98 views asked Feb 4, 2023 by avibootz
2 answers 240 views
240 views asked Jul 14, 2020 by avibootz
1 answer 110 views
1 answer 180 views
...