Question: I have a code that goes through a text file and identifies if it is a Read(R) or Write (W) converting hexadecimal values to decimal.
10 int main (int argc, char argv[I) 11 |EN 12 13 char filename [15]: 14 char line [FILELENGTH] 15 long long int number: 16 17 18 19 scanf ("%s", &filename); 20 .c int i - 0 char skip; bxt eb printf ("Whats the filename:): FILE *ifp# fopen (filename , "r"); if (ifpNULL) 21 23 24 25 26 27 28 29 30 printf ("ERROR with file" return 1: while (fgets(line, sizeof (line),ifp) NULL) if (line[i 31 32 line [strlen (line)-1]-D"; printf ("value in Hex: tsin", line) number (int) strtol (line, NULL, 26) printf ("Value in Decimal: idn", number): printf(nla"): 34 36 37 3e 39 40 else if(line( C/C++ Windows (CR-LF) WINDoWS-1252 extfilee main.cpp
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
