We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

general

we are using printf and scanf from #include<stdio.h> libraray functions.is it possible to write our own display statement and input statement

4
Contributors
4
Replies
5 Hours
Discussion Span
9 Months Ago
Last Updated
5
Views
rithish
Posting Whiz in Training
268 posts since Apr 2011
Reputation Points: 23
Solved Threads: 9
Skill Endorsements: 0

yes u can. You can use putchar() and getchar and you can write fucntions using that.

I_m_rude
Deleted Member

Do you mean you want to write your own library for I/O or use macros for those existing functions? also fyi the latter is bad programming

zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14

is it possible to write our own display statement and input statement

Certainly. How do you think the stuff from stdio.h was written? One cool thing about the standard C library is pretty much all of it can be written directly in C. I've actually implemented the standard C library before, and whole books have been written with that focus.

As far as writing your own output function without utilizing the standard library, you'll almost certainly end up using a system library like Linux's write() or Windows' WriteFile(). Sure, you could use assembly interrupts, but that's just crazy talk unless you're writing for a platform that for some reason doesn't expose a C interface for I/O.

On a side note, the linked book is one of my favorites. The code is a hard read, but you can learn a lot from it.

deceptikon
Challenge Accepted
Administrator
3,460 posts since Jan 2012
Reputation Points: 822
Solved Threads: 474
Skill Endorsements: 57

everyone is reading from dennis ritchie implementations of library function.similiar to this in java package concept they are writting import java.awt.event where action listner they r writting i dont know how a byte code is translated into program such a great thing that is

rithish
Posting Whiz in Training
268 posts since Apr 2011
Reputation Points: 23
Solved Threads: 9
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.3041 seconds using 2.91MB