C Language program problem.
Suppose that I want to create a program by using command line. User will type a name of file such as "test.data" to access the content of the file.
Program should scan whole file and create a list with 30 position .
You should show the two situation, one is for when scanned space, the other one is when it scanned new line.
Then the other task is printing them out.

You see there are spaces and next lines in the file which program will scan.
I want to see how to fetch the correct elements when they are divided by space.
Also, I want to see how to fetch the correct elements when they are divided by next line.
HERE FSCANF WILL READ THE FILE WORD BY WORD SEPERATED BY THE SPACE.
IT CONSIDERS THE NEW LINE ALSO AS A SPACE.
HENCE WE DO NOT HAVE TO WORRY ABOUT THE NEWLINE AND THE SPACE.
CODE::
#include <stdio.h>
#include <stdlib.h>
int main ()
{
//required variables
char filename[20],word[50],*list[30]={""};
int i=0;
FILE *file ;
printf("Enter file name :");
scanf("%s",filename);
//creating the file pointer
file = fopen (filename, "r");
//loop to read word after the space
while(fscanf(file, "%s",word)==1)
{
//printing current word
printf("Current word :: \"%s\"\n",word);
//adding word to list
list[i++]=word;
if(i==30) break;
//end of loop
}
//printing report
printf("\nData copied to list successfully!");
//closing the file pointer
fclose(file);
//exiting funciton with returning 0
return(0);
}
OUTPUT::

C Language program problem. Suppose that I want to create a program by using command line....
In C please
Create a program that takes two integers as command line
arguments (num, length) and outputs a list of the first length
multiples of num. num should be included in the returned array.
For example:
./a.out 7 5 -> [7, 14, 21, 28, 35]
./a.out 12, 10 -> [12, 24, 36, 48, 60, 72, 84, 96, 108,
120]
./a.out 17, 6 -> [17, 34, 51, 68, 85, 102]
Ma Word starts with a vowel add "yay" to the...
C Language Programming. Using the program below - When executing on the command line only this program name, the program will accept keyboard input and display such until the user does control+break to exit the program. The new code should within only this case situation “if (argc == 1){ /* no args; copy standard input */” Replace line #20 “filecopy(stdin, stdout);” with new code. Open read a text file “7NoInputFileResponse.txt” that contains a message “There were no arguments on the...
C++ File I/O Create a program that will work for all "infile.txt" of similar structure: The first line will contain two integers. The first integer is the number of elements in array1, and the second integer the number of elements in array2. The second line will contain all the values of array1, and the third line will contain all values of array2. All numbers are separated by a space and all lines separated by a newline character. "infile.txt" has three...
Using c++ Write a program that reads in a list of up to 25 first names from an input file nameData.txt and allows the user to display the name data, sort it in ascending or descending order, count the number of occurrences of a given name, or exit the program. The input file consists of a single names per line with each line terminated with an end of line (i.e. using Enter key to end the line). Your program should...
I am writing a C program that takes either command line arguments or has a file passed to it using < on the command line. My question is how do I check to see if there is a file passed using <. I think I need a way to check stdin to see if there is any data present. Thanks
write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : i have 15 min to submit the solution please help me You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other...
Program Language: PYTHON Consider the following file structure: each line of the file contains a word. The words are in sorted order. For example, a file might look like this apple apple apple apple banana bargain brick brick sample sample simple text text text Write a program that asks the user for a filename with this structure. The program's job is to write the sequence of words to another file, without any duplicates. Name the output file result.txt. Each word is...
write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...
Command line input In C++ it is possible to accept command line arguments. Command-line arguments are given after the name of a program in command-line operating systems like Linux and are passed in to the program from the operating system. To use command line arguments in the program, it must first understand the full declaration of the main function, which until now has accepted no arguments. In fact, main can accept two arguments: one argument is number of command line...
C programming Question1 (a) Write a C program that will print out all command line arguments, in reverse order, one per line. Prefix each line with its index. 6 marks] (b) Consider this C code snippet int a- 100 int b- 42; inte p- &a; int q-b; p qi printf ("%d %d\n" ,a,*p); When this code is executed, what numbers will it print? [2 marks] (c) Consider this C program int main(int argc,char argv) char* target- "Apple" char vord[100] printf...