UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How can I write my own printf() scanf() functions in C or assembly without using other libraries?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

Tutor

you can follow below instructions- Learn about variable parameter argument lists in C. Then you might understand the printf/scanf functions better. One of the problems is that you have to parse the first parameter (the format) to determine how many, and what type each parameter is. Variable argument...
read more
you can follow below instructions- Learn about variable parameter argument lists in C. Then you might understand the printf/scanf functions better. One of the problems is that you have to parse the first parameter (the format) to determine how many, and what type each parameter is. Variable argument lists are very useful - it is one way to create functions with named parameters. read less
Comments

Advance Excel And VBA Training

How can I use my own implementation of 'printf()' without needing to recompile my application code? Applies to: DS-5, RealView Development Suite (RVDS) Scenario The compiler normally translates "printfs" in application source code into calls to optimized versions in the ARM-supplied C libraries....
read more
How can I use my own implementation of 'printf()' without needing to recompile my application code? Applies to: DS-5, RealView Development Suite (RVDS) Scenario The compiler normally translates "printfs" in application source code into calls to optimized versions in the ARM-supplied C libraries. This optimization can be disabled by recompiling with the compiler switch -Ono_fp_formats (for RVCT 2.x) or --library_interface=aeabi_clib (for RVCT 3.0 or later) as described by the article: How do the ARM Compilers handle printf, sprintf, fprintf and scanf?. But if the programmer would like to use their own printf implementation without having to recompile their application source code (e.g. because the object code was provided by a third-party and cannot be changed), a different approach is needed. Answer All internal optimized "printfs" are linked-in from the ARM-supplied C libraries at link-time. During compilation, when the compiler sees a call to one of the printf functions and it recognizes the format string or arguments, it will change the call to __Nprintf (where N depends on the ARM Compiler version). The compiler may also need to import various symbols depending on the format string and arguments. For RVCT 2.x/3.0, the renamed symbol is __0printf. It is __1printf for RVCT 3.1 and __2printf for RVCT 4.0 and later versions. Beware that this naming scheme may change in future releases of ARM Compiler Tools. The user should reimplement these renamed symbols to redirect them to their own version of printf. The recommended way is to use an assembly file, for example: AREA retarget_Nprintf, CODE, READONLY IMPORT printf EXPORT __0printf EXPORT __1printf EXPORT __2printf __0printf __1printf __2printf B printf END This assembly file would then work for third party objects that are built using any current version of ARM Compiler. sprintf(), fprintf() and scanf() can be handled in the same way. read less
Comments

Related Questions

Does a civil engineer need to learn the C language?
C language is a common subject in the first year of engineering irrespective of the branch. It may not be helpful for your civil engineering career but you definitely need to pass for B.Tech graduation.
Sandeep
0 0
5
What is meant by high-order and low-order bytes?
Lower order and higher-order bytes are the terms used while computing calculations in a programming language. Usually, numbers are written from left to right. The left is the most significant bit, and...
Vishal
0 0
9
What is a calling function in C?
Calling function is the one where the function call has been made and after executing the called function, control returns to the calling function.
Gowre
0 0
5
hello sir my name is suryateja i am studying in diploma in computer science and engineering my college complect in c language subject i practice with in simple programs my write to won programs how it you?
Hi Syateja, if I understand your questions correctly let me answer. Best thing to learn and progress is to practice writing programs, initially small programs then gradually can write complex program....
Suryateja
Why is the C language important?
C language is a high-level, general-purpose programming language. It provides a straightforward, consistent, powerful interface for programming systems. That's why the C language is widely used for developing...
Ganesh
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

C Program-Upper Case Demo
/*WAP to print the character entered by user in upper case*/ //Header files #include<stdio.h>#include<conio.h> //Main function void main(){ char ch; //Function for clearing screen clrscr(); ...
S

Pointers Concept
Every variable has a memory location and every memory location has its address defined which can be accessed using ampersand (&) operator, which denotes an address in memory. Consider the following...

C Program-Error Handling[Program Exit Status]
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main Function void main(){ int dividend=20; int divisor=5; int quotient; //Function for clearing screen clrscr();...
S

Compiler vs Interpreter
Compiler Interpreter Convert all the code into binary format and execute. Convert one statement at a time and execute, then Convert next statement and execute. After conversion, source...

Find out the Output of the following with reason and get C Language Training fess less by 10%
1. void main() { clrscr(); printf(5+"Beautifull"); getch(); } 2. void main() { int a=50; clrscr(); ...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more