CSIT-401 Operating Systems Simple Parser Project Part 1: 30 points Create a C program that will read in a string and a single char delimiter. You will then split up the string based on the delimiter....

1 answer below »


CSIT-401 Operating Systems


Simple Parser


Project Part 1: 30 points


Create a C program that will read in a string and a single char delimiter. You will then split up the string based on the delimiter. You should do the splitting and length calculation in one function, that you will use in future projects. You must use the malloc function to allocate memory and copy data to the allocated memory. You may NOT use the string tokenizing methods built into the C language. Use command line arguments to read in the word and delimiter as input (https://www.tutorialspoint.com/cprogramming/c_command_line_arguments.htm(Links to an external site.)).


For example the inputa:bbbbA:ccwith a delimiter:will give the output



a Length 1


bbbbA Length 5


cc Length 2


For example the input123-456-7890with a delimiter-will give the output



123 Length 3


456 Length 3


7890 Length 4


Turn in:



A program called parse1.c


Example:



Screen Shot 2020-08-29 at 10.06.04 PM.png

Answered Same DaySep 14, 2021

Answer To: CSIT-401 Operating Systems Simple Parser Project Part 1: 30 points Create a C program that will read...

Himanshu answered on Sep 15 2021
149 Votes
#include
#include
#include
void show(char *arg1, char *arg2);
in
t main(int argc, char *argv[])
{
if( argc == 3 ) {
show(argv[1],argv[2]); // calling show method with command line arguments
}
else{
printf("Only two arguments Acceptable"); // if arguments are less or more than two
}
return 0;
}
void show(char *arg1, char *arg2){

//copying command line argument arg2 into str
char *str = (char *)...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here