Ncurses and Standard Functions

This is a discussion on Ncurses and Standard Functions within the C Programming forums, part of the General Programming Boards category; Ok im just starting to learn the ncurses api and have been experimenting Code: #include <ncurses.h> int main() { initscr(); ...

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    68

    Ncurses and Standard Functions

    Ok im just starting to learn the ncurses api and have been experimenting

    Code:
    #include <ncurses.h>
    
    int main()
    {
    	initscr();
    	printw("Hello World");
    	getch();
    	endwin();
    	return 0;
    }
    The hello world program they show you printw is a ncurses print and still not quite sure on how it works exactly yet however if I change printw to say puts or printf Hello World doesnt display.

    Now ive been going through the man pages and the main ncurses tutorial (http://en.tldp.org/HOWTO/NCURSES-Pro...elloworld.html), now it doesnt state that you can or cant use the standard functions Im guessing by the experiement and the result I got (a blank screen) i have to use the ncurses printf version.

    Now firstly is it possible, i probably already answered my question and if I have does anyone know of a link just to verify why this happens ive been searching and unfortunately cant find anything which states the stdio functions dont work.

  2. #2
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    Code:
    #include <ncurses.h>
    
    int main()
    {
        initscr();
        printw("Hello World");
        getch();
        endwin();
        return 0;
    }
    Does that even work? It lacks refresh().

    Now firstly is it possible
    I don't know the answer =), but unless there's a good reason to then why even mess with it.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    68
    No it doesnt work I accidently deleted it from the original code when experiementing. Why, well mainly because in some cases being able to use puts and scanf would be good however I dont think there really is a puts alternative other then using wprint and using the newline character.
    Code:
    wprint("\n");
    Scanf has its own function but just remembering to have to switch between using the standard functions and using ncurses wrapper functions is going to be a tad annoying. Just thought it might be possible i guess its not.
    Last edited by gsoft; 02-07-2005 at 07:21 PM.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21