pgm without std library functions

L

Letsee++

hi,
is it possible to write a program to read and print a number without
using standard library functions in C and C++?
if yes ....how?
waiting for a reply...
 
B

Ben Pope

Letsee++ said:
hi,
is it possible to write a program to read and print a number without
using standard library functions in C and C++?

Define "read" and "print".

The answer is probably no.

Why would you not want to use the standard library? It's really quite
useful, and, err... part of the standard for a reason.

Ben Pope
 
R

Rolf Magnus

Letsee++ said:
hi,
is it possible to write a program to read and print a number without
using standard library functions in C and C++?
if yes ....how?

The answer is a definite "maybe". Many platforms offer other, non-standard,
functions that could be used for this. On some, you might even be able to
do some specific hackery to access the hardware directly.
 
O

osmium

Letsee++ said:
is it possible to write a program to read and print a number without
using standard library functions in C and C++?
if yes ....how?

You could certainly do it on machines in the DOS era. I can't remember all
the buzz words, x86 comes to mind. You could communicate with the OS via a
kind of back door. I suspect if one were clever enough you might still be
able to do something. I wrote a routine to print (on a *printer*) that
still worked with Windows 98 using these techniques I am thinking of -- I
haven't used it lately. This avoided the heavily burdened GUI way of
printing, so it actually served a purpose. You could do printing
concurrently with program execution is a Windows program (which a "console"
program is).

Consider also what you might do with the system() function.
 
L

Letsee++

This question was asked in an IT fest in my college...they asked us to
write a pgm without using std library functions..even if i failed to
develop it ,i want to know how it can be acheived and i have asked many
of my frnds and seniors ,but havent got the answer...
plz help...
 
T

Thomas Ritter

Letsee++ said:
hi,
is it possible to write a program to read and print a number without
using standard library functions in C and C++?
if yes ....how?
waiting for a reply...

Not portable... but...

you could <shudder>use DOS.</shudder> Use _asm to call int 21.

Or just use a non standard library, there are many. ;)

Thomas Ritter
 
B

benben

Letsee++ said:
hi,
is it possible to write a program to read and print a number without
using standard library functions in C and C++?
if yes ....how?
waiting for a reply...

If somehow you can get access to keyboard input and manipulate screen
drawing then the answer is yes.

Ben
 
R

Rolf Magnus

Letsee++ said:
This question was asked in an IT fest in my college...they asked us to
write a pgm without using std library functions..

Well, you can write a program without any libraries, but it won't be able to
do much.
even if i failed to develop it ,i want to know how it can be acheived and
i have asked many of my frnds and seniors ,but havent got the answer...

Was that supposed to be about standard C++ or some system specific
implementation/dialect of C++? In standard C++, there is simply no way.
 
R

Rolf Magnus

Victor said:
Please post C questions to "comp.lang.c".

No! Only questions about standard C go there, and the OP's request can't be
fulfilled in standard C, just like it can't in standard C++.
 
N

Noah Roberts

Letsee++ said:
hi,
is it possible to write a program to read and print a number without
using standard library functions in C and C++?
if yes ....how?
waiting for a reply...

Yes. The way how is platform dependant. As the std library does such
things it is of course always possible to write your own version that
also does. However, such discussion is not topical for this group.
Try one having to do with the target platform.
 
A

ansumanm

you will have to use system calls .. read and write
i dont remember the syntax ..write(STDOUT,buf,..);
look for it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top