Enter a directory file name from the keyboard;
Print A. c file to determine whether the curly braces appear in pairs;
#include <stdio.h>int main () {file *rfile = null;char*pput=null;char name[100] = "0"; int count=5;char ch= ' 0 '; flag:printf ("Please enter the directory and name of the file you want to read (EG:C:\\WINDOWS\\TEST.C): \ n"); scanf ("%s", name), rfile = fopen (name, "R");if (rfile == null) { printf ("The file you want to access does not exist, please re-enter the directory!") \ n "); goto flag;} else{while (ch != eof) {ch = fgetc (rfile);p Utchar (CH);} Fclose (Rfile); Rfile = fopen (name, "R");ch = ' 0 ';while (ch!= eof) { CH&NBSP;=&NBSP;FGETC (Rfile); if (ch== ' {') count++; if (ch== '} ') count--;} if ( 5 == count ) printf ("\ n curly braces appear in pairs!") "); else if (count > 5) printf (" \ n a positive or a parenthesis is more than an inverse or parenthesis %d\n***********************", count - 5); else printf (" \ n the inverted curly brace is more than the curly brace %d\n*************************************** ", 5 - count);} return 0;}
C Simple Program