Wednesday, 2 June 2021

How to write a function that works similar to scanf in C?

I accept actual frequently apparent bodies black others from application scanf and adage that there are bigger alternatives. However, all I end up seeing is either "don't use scanf" or "here's a actual architecture string", and never any examples of the "better alternatives" mentioned. For example, let's booty this atom of code: scanf("%c", &c); This reads the whitespace that was larboard in the ascribe beck afterwards the aftermost conversion. The accepted appropriate band-aid to this is to use: scanf(" %c", &c); or to not use scanf. Since scanf is bad, what are some ANSI C options for converting ascribe formats that scanf can usually handle (such as integers, floating-point numbers, and strings) after application scanf?

No comments:

Post a Comment

C Programming

What is DBMS in brief?

A Database Management System (DBMS) is a software suite designed to efficiently manage, organize, store, manipulate, and retrieve data. It a...