Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getc(3f) [bsd man page]

GETC(3F)																  GETC(3F)

NAME
getc, fgetc - get a character from a logical unit SYNOPSIS
integer function getc (char) character char integer function fgetc (lunit, char) character char DESCRIPTION
These routines return the next character from a file associated with a fortran logical unit, bypassing normal fortran I/O. Getc reads from logical unit 5, normally connected to the control terminal input. The value of each function is a system status code. Zero indicates no error occurred on the read; -1 indicates end of file was detected. A positive value will be either a UNIX system error code or an f77 I/O error code. See perror(3F). FILES
/usr/lib/libU77.a SEE ALSO
getc(3S), intro(2), perror(3F) 4.2 Berkeley Distribution May 27, 1986 GETC(3F)

Check Out this Related Man Page

GETC(3S)																  GETC(3S)

NAME
getc, getchar, fgetc, getw - get character or word from stream SYNOPSIS
#include <stdio.h> int getc(stream) FILE *stream; int getchar() int fgetc(stream) FILE *stream; int getw(stream) FILE *stream; DESCRIPTION
Getc returns the next character from the named input stream. Getchar() is identical to getc(stdin). Fgetc behaves like getc, but is a genuine function, not a macro; it may be used to save object text. Getw returns the next word from the named input stream. It returns the constant EOF upon end of file or error, but since that is a good integer value, feof and ferror(3) should be used to check the success of getw. Getw assumes no special alignment in the file. SEE ALSO
fopen(3), putc(3), gets(3), scanf(3), fread(3), ungetc(3) DIAGNOSTICS
These functions return the integer constant EOF at end of file or upon read error. A stop with message, `Reading bad file', means an attempt has been made to read from a stream that has not been opened for reading by fopen. BUGS
The end-of-file return from getchar is incompatible with that in UNIX editions 1-6. Because it is implemented as a macro, getc treats a stream argument with side effects incorrectly. In particular, `getc(*f++);' doesn't work sensibly. GETC(3S)
Man Page

15 More Discussions You Might Find Interesting

1. Programming

Keyboard Strokes w/o Delay...

Hello(again), but I was wondering how you would obtain a keyboard stroke from a user with no delay(they don't have to hit enter) and then place that stroke into a variable? Lets say you tell the user to hit, on the numpad, a number. Then that number is placed into a variable w/o the user hitting... (2 Replies)
Discussion started by: mbolthouse
2 Replies

2. Programming

Yet Another Question

Now that I have getch() to work, I have yet another problem. BTW, thank you for answering these questions, I do ask a lot, only because I am eager to know, what is a board used for anyways :) Ok, he's the problem... #include iostream.h #include conio.h int main() { char movement; ... (2 Replies)
Discussion started by: mbolthouse
2 Replies

3. UNIX for Dummies Questions & Answers

getchar()

hey everyone! got another problem here. how would i use the getchar() in a prompt: Press any key to continue the way i did it was to define a char variable named ch and then wrotechar ch ... ch = getchar(); printf("Press any key to continue"); getchar():if you press enter it exits, but... (2 Replies)
Discussion started by: primal
2 Replies

4. UNIX for Advanced & Expert Users

getcwd: permission denied error

When I do a 'cd /appl' and issue 'ls -al' command, I get the following error for .. directory. ./..: Permission denied But still I get a listing of other directories under /appl. Also, if I give 'man' for any command under this /appl folder, I get the following error: ... (3 Replies)
Discussion started by: Deepa
3 Replies

5. Programming

get process name from pid - getcommandline

All, I have a requirement to get the process name of the newly execv'd process. After getting the complete process name, I need to carry out further operations on that. Problem so far is how do I retrieve the name of the process ? There is an API in windows called GetCommandLine. I... (2 Replies)
Discussion started by: vino
2 Replies

6. Programming

Undefined symbol: .getcury in getyx

Iam attempting a script to return the current cursor position using the getyc macro I have #included the curses.h however on compilation (with gcc) it errors with Undefined symbol .getcury Undefined symbol .gercurx Any ideas where I can find a solution or what I've missed (7 Replies)
Discussion started by: gefa
7 Replies

7. Solaris

invalid getconf output and Perl compile

I was compiling perl on a Solaris 10 server. The compile failed because the output of getconf is wrong (it indicates xarch is generic64 not v9. This is a known bug but I cannot find a fix. I wrote a script as suggested that changes it but when you run getconf again it goes back to generic64. ... (2 Replies)
Discussion started by: csross
2 Replies

8. Solaris

shell-init: could not get current directory: getcwd: cannot access parent directories

Hello root@ne-ocadev-1:/root/scripts>su espos -c find /a35vol100/ESPOS/oracle/db/9.2.0/oradata/ESPOS/archive -type f -atime +10 -exec ls {} shell-init: could not get current directory: getcwd: cannot access parent directories: Permission denied find: insufficient number of... (6 Replies)
Discussion started by: babu.knb
6 Replies

9. Shell Programming and Scripting

Bash replacement to getchar

There's a replacement in bash for getchar or get functions of C and C++?Those functions read the next char avaliable in the input stream. I've tried something like: OLD_STTY=`stty -g` stty cbreak -echo look=`dd if=/dev/tty bs=1 count=1 2>/dev/null` stty $OLD_STTY But it is not working... (3 Replies)
Discussion started by: Asafe
3 Replies

10. Programming

getch & getche not in ubuntu

Hi I tried executing a C rogram with getch or getche functions in my linux termibal @ ubuntu I used gcc compiler. On compiling the code, it throws error as below. However, I included <stdio,h> and <stdlib.h> in my source code. ganesh@ubuntu:~/my_programs/c/letusc/chap11$ gcc -o gb gb.c... (12 Replies)
Discussion started by: ramkrix
12 Replies

11. Shell Programming and Scripting

getcwd problem.

hi all. i need your help. this is my problem. shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory i do not know how to solve this problem.:confused: thanks (3 Replies)
Discussion started by: annetote
3 Replies

12. Programming

How to skip getchar in C?

Hi, I would like to read an input from keyboard using getchar. However, if no input (No Carriage return/new line none whatsoever) is given after say, 5 seconds, I would like to skip the getchar and move on. How do I do this in C. I'm using GNU compiler set. Thanks, (5 Replies)
Discussion started by: cprogdude
5 Replies

13. Programming

Help on getchar

I wanted to make a simple program that writes chracters in a file but i didnt want to press enter .So i found the getchar which doesnt need enter.If i pass (int) getchar to putc ,in the file it shows a P character.The (int) getchar says it is equal to1734747216 so i do (int) getchar-1734747216... (4 Replies)
Discussion started by: fireblast
4 Replies

14. Programming

What is the difference between printf and putchar() or scanf and getchar() ?

Im a newbie to programming language, i found tat there r these function called printf and putchar() as well as scanf and getchar(), im curious abt why do dey hav these 2 different function although dey r doing the same instruction? :confused: (13 Replies)
Discussion started by: kris26
13 Replies

15. Solaris

Getcwd performance issues

Hello everyone, recently we have been experiencing performance issues with chmod. We managed to narrow it down to getcwd. The following folder exists: /Folder1/subfol1/subfol2/subfol3 cd /Folder1/subfol1/subfol2/subfol3 truss -D pwd 2>&1 | grep getcwd 0.0001... (4 Replies)
Discussion started by: KotekBury
4 Replies