fgetc+ungetc. Maybe something like this:
int fpeek(FILE *stream)
{
int c;
c = fgetc(stream);
ungetc(c, stream);
return c;
}
More Related Contents:
- ‘ ‘, ‘\n’ , scanf() and output screen
- How to work with a variable number of variables in C?
- How to read / parse input in C? The FAQ
- Rerouting stdin and stdout from C
- What are the rules of automatic stdout buffer flushing in C?
- Code for printf function in C [duplicate]
- Reading a line using scanf() not good?
- stdlib and colored output in C
- What’s the best way to return a random line in a text file using C?
- What will happen if ‘&’ is not put in a ‘scanf’ statement?
- Is there a Windows equivalent to fdopen for HANDLEs?
- GCC fatal error: stdio.h: No such file or directory
- How can you flush a write using a file descriptor?
- What is the difference between getch() and getchar()?
- printf not printing to screen
- Why does forking my process cause the file to be read infinitely
- What exactly is the FILE keyword in C?
- Is there any way to peek at the stdin buffer?
- Unable to open a file with fopen()
- whitespace in the format string (scanf)
- Why does this code print two times? [duplicate]
- How can one flush input stream in C?
- ftell at a position past 2GB
- Tried and true simple file copying code in C?
- How to fgets() a specific line from a file in C?
- ungetc: number of bytes of pushback
- Is close/fclose on stdin guaranteed to be correct?
- How to get file creation date in Linux?
- Assign string to element in structure in C
- Order of fields when using a bit field in C