Thread: Is possible read text form keyboard using read() function?

  1. #1
    Registered User
    Join Date
    Dec 2013
    Posts
    46

    Is possible read text form keyboard using read() function?

    Is possible read text form keyboard using read() function? or which is best way in ansi creplace input command form basic language. for numbers and text... ideas not code again becouse i try learn. i know i asked so much in so little time but i have so many ideas in my head...

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If there was a read command, that would be one thing. Since there isn't, you'll have to make do with either scanf or fgets.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    At the top (dark blue) bar of this website, there is a link to an excellent C Tutorial. You would benefit a great deal by studying it. It will show you what functions are standard with the C language, and how to use the most common one's.

    Bookmark it, and work through it - there are many other tutorials on the net for C, but few are as good.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,076
    Sure, using POSIX read() with file descriptor 0 will read from standard input.

    Whether standard input is your keyboard (as far as the program is concerned) might be harder to tell.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 12-07-2012, 10:44 PM
  2. Function to read lines of text
    By Cevris in forum C Programming
    Replies: 8
    Last Post: 05-12-2011, 07:19 AM
  3. Ncurses form can't be read out correctly
    By vIiRuS in forum C Programming
    Replies: 9
    Last Post: 08-09-2010, 12:22 PM
  4. how to read property of external form?
    By Look- in forum C# Programming
    Replies: 1
    Last Post: 10-18-2009, 01:37 PM
  5. getline function to read 1 line from a text file
    By kes103 in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2004, 06:21 PM