Page 1 of 1

could you use normal functions like "printf"

Posted: Sun Sep 23, 2001 11:00 pm
by truenoteno
When you compile apps in C, without dos could you use "printf" still ?
Or do you have to integrate assembly into C.

RE:could you use normal functions like "printf"

Posted: Sun Sep 23, 2001 11:00 pm
by Chris Giese
>On 2001-09-24 20:04:12, truenoteno wrote:
>When you compile apps in C, without dos could you use "printf" still ?

printf() will eventually call a function to send
text to stdout. No DOS, no stdout.

If you have cprintf(), it might work without changes. If not, you might be able to use sprintf():

char buf[64];
sprintf(buf, "%u score and 7 years ago", 4);
cputs(buf);

(write your own cputs() function)

The printf() functions call a lot of other
code, for different character sets, floating
point math, etc, so it might be difficult to
use them without an OS. If all else fails,
you can write your own printf() or use mine:
http://www.execpc.com/~geezer/osd/code/ ... doprintf.c
http://www.execpc.com/~geezer/osd/code/inc/_printf.h
http://www.execpc.com/~geezer/osd/code/inc/stdarg.h

>Or do you have to integrate assembly into C.

You can write printf() in C.

Re: could you use normal functions like

Posted: Sat Nov 07, 2009 5:22 pm
by jbarrow
I am under the assumption that you can't use printf when you call it without DOS, unfortunately. Same with inputting data from what the user typed, or even letting the user see what they typed. This all has to be done by implementing C with ASM. I understand that normally you use 'extern void' to call an ASM function in C.

Re: could you use normal functions like

Posted: Sat Nov 07, 2009 5:31 pm
by -m32
Seriously?? This thread is 8 years old!

Re: could you use normal functions like

Posted: Sun Nov 08, 2009 4:14 am
by Combuster
I'd say Necro and sheer stupidity. Please learn to read first.
you wrote:you can't use printf
Chris Giese wrote:you can write your own printf()
You wrote:This all has to be done by implementing C with ASM
Chris Giese wrote:You can write printf() in C.