FIle:Data structure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swathi RB
    New Member
    • Mar 2014
    • 1

    FIle:Data structure

    I have edited the program like this

    #include<stdio. h>
    void main()
    {
    FILE *f;
    char c,p;
    clrscr();
    printf("Data Input:\n");
    f=fopen("INPUT" ,"w");
    p=EOF;
    while((c=getcha r())!=EOF)
    putc(c,f);
    fclose(f);

    printf("Data Output:\n");
    f=fopen("INPUT" ,"r");
    while((c=getc(f ))!=EOF)
    printf("%c",c);
    fclose(f);
    }
    But I am not able to find out the which indicates the end of the file while i am reading the charectors from the keyboard...? i have tried the cntrl+z... but of no use... please let me know... other indication of the EOF.... of the file of my system windows...... sir?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    EOF is an int and not a char. On the keyboard CTRL+Z means end of all input.

    Comment

    Working...