C equivalent to fstream's peek

I know in C++, you're able to peek at the next character by using: in.peek();.

How would I go about this when trying to "peek" at the next character of a file in C?

Answers


fgetc+ungetc. Maybe something like this:

int fpeek(FILE *stream)
{
    int c;

    c = fgetc(stream);
    ungetc(c, stream);

    return c;
}

Need Your Help

Removing elements with Array.map in JavaScript

javascript data-structures functional-programming client-scripting data-manipulation

I would like to filter an array of items by using the map() function. Here is a code snippet:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.