Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    C putw

    C putw() function is used to write an integer to a file. This tutorial guides you on how to use the putw() function in the C program.

    Syntax:

    int putw( int c, FILE * stream );

    Example:

    int main (void)
    {
        FILE *fileName;
        int i=2, j=3, k=4, n;
        fileName = fopen ("anything.c","w");
        putw(i, fileName);
        putw(j, fileName);
        putw(k, fileName);
        fclose(fileName);
    
        fileName = fopen ("test.c","r");
        while(getw(fileName)! = EOF)
        {
            n= getw(fileName);
            printf("Value is %d \t: ", n);
        }
        fclose(fp);
        return 0;
    }


    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.