UNGETC(3S)UNGETC(3S)NAME
ungetc - push character back into input stream
SYNOPSIS
#include <stdio.h>
ungetc(c, stream)
FILE *stream;
DESCRIPTION
Ungetc pushes the character c back on an input stream. That character will be returned by the next getc call on that stream. Ungetc
returns c.
One character of pushback is guaranteed provided something has been read from the stream and the stream is actually buffered. Attempts to
push EOF are rejected.
Fseek(3S) erases all memory of pushed back characters.
SEE ALSO getc(3S), setbuf(3S), fseek(3S)DIAGNOSTICS
Ungetc returns EOF if it can't push a character back.
7th Edition May 15, 1985 UNGETC(3S)
Check Out this Related Man Page
UNGETC(3) BSD Library Functions Manual UNGETC(3)NAME
ungetc -- un-get character from input stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int
ungetc(int c, FILE *stream);
DESCRIPTION
The ungetc() function pushes the character c (converted to an unsigned char) back onto the input stream pointed to by stream. The pushed-
back characters will be returned (in reverse order) by subsequent reads on the stream. A successful intervening call to one of the file
positioning functions (fseek(3), fsetpos(3), or rewind(3)), using the same stream, will discard the pushed-back characters.
Only one character of push-back is guaranteed, but as long as there is sufficient memory, an effectively infinite amount of push-back is
allowed.
If a character is successfully pushed-back, the end-of-file indicator for the stream is cleared. The file-position indicator is decremented
by each successful call to ungetc(); if its value was 0 before a call, its value is unspecified after the call.
RETURN VALUES
The ungetc() function returns the character pushed-back after the conversion, or EOF if the operation fails. If the value of the argument c
character equals EOF, the operation will fail and the stream will remain unchanged.
SEE ALSO fseek(3), getc(3), setvbuf(3), ungetwc(3)STANDARDS
The ungetc() function conforms to ISO/IEC 9899:1990 (``ISO C90'').
BSD June 4, 1993 BSD
Can anyone help me?????
My problem is that i want to read only one charcter from keyboard. Each time my program waits to press enter or ^d. I don't want that. As soon as i press a charcter it should proceed to next statement in program without pressing enter or ^d.
please help... (3 Replies)
Hi Friends,
When Iam running c program in redhat linux 7.3 version and PCQ Linux 8.0 version, its taking around 20 seconds. But when Iam running it in HP-UX Release 11i, its taking around 3 minutes. Can anyone throw light on this.
Thanks in advance,
Praveen. (11 Replies)
I'm trying to write a program that will open an existing file supplied by the command line argument and then replace words with "We" or "we" by "I" and "a" or "A" by "The". When I run the program it reads the file, changes the word but re writes it on a new line with only the replaced words not the... (1 Reply)
I am trying to work this little program, its not working..
int main()
{
FILE *fp;
char *args;
pid_t child, exited_pid;
int status = 0;
*args = "less";
fp = popen("ls", "r");
child =... (4 Replies)
what is the difference between
fopen and open
fread and read
fwrite and write
open and create
why this much of functions for the i/o when everything does the same...?
What is their major difference?
In which case, which is the best to use.
:confused:'ed Collins (2 Replies)
Good evening, I'm trying to do my own shell and I encountered some issues while creating it. Indeed when I try such a command I have
DAUPHINE> DAUPHINE> ls -l | grep terminal > fichier
DAUPHINE> cat fichier
My shell is named DAUPHINE
Whereas I should have:
Code:
... (0 Replies)
I am building a wrapper around fgets, and fighting crashes for no reason I can explain.
I have stripped it down as far as I can and it still crashes.
#include <stdio.h>
#include <stdlib.h>
typedef struct {
char buf;
FILE *fp;
int type;
} wrap;
wrap... (12 Replies)
I have a huge text file, about 52 GB. In the file, there are patterns like these:
]
]
]
]One can see that there is text within patterns such as and ], and I am only interested in ]. There is text before and after all these patterns too, for example,
''Anarchism''' is a ] that advocates ]... (3 Replies)
I have an array in an external file, "array.txt", which contains:
char *testarray={"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"};I want to be able to add an element to this array, and have that element display, whenever I call it, without having to recompile... (29 Replies)
Hi, all,
I'm writing a BBS telnet client, and am trying to implement a status bar into it, at the bottom of the screen.
I am using NCurses to accomplish this. So far, it appears to be working, that is, upon connecting to BBS, it
will display the status bar, and then quickly disappear.
... (5 Replies)
Hi,
I have an array, that works well. But, I want to have it display every other line. Like so, 1, 3, 5, 7, etc, etc.
Here is the relevant code:
I'm sorry for the pastebin link. For some reason, I can't get the code to format properly with the code tags.
code tags work fine... everyone... (4 Replies)