-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
40 lines (39 loc) · 954 Bytes
/
Copy pathmain.cpp
File metadata and controls
40 lines (39 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <string.h>
extern void Step1(char *text);
extern bool isTerminal(char t);
extern void Step2(char *text);
extern bool isLeftBorder(char c);
extern bool isRightBorder(char c);
extern void substr(char *str1, char *str2, int begin, int end);
extern void begin_substr(char *str1, char *str2, int end);
extern void end_substr(char *str1, char *str2, int begin);
extern void Step3(char *text);
extern bool isRuleNew(char *text, char *rule, int right_part_begin);
extern void Step4(char *text);
extern void Step5(char *text);
main(int argc,char *argv[])
{
FILE* in=fopen(argv[1],"r");
if(in==NULL)
printf("File does not exist\n");
else
{
char text[100]="\0";
char* str_err;
char str[50];
str_err=fgets(str, 50, in);
while(str_err!=NULL)
{
strcat(text, str);
str_err=fgets(str, 50, in);
}
Step1(text);
Step2(text);
Step3(text);
Step4(text);
Step5(text);
printf("%s\n", text);
fclose(in);
}
}