1.Required Header files are
stdio.h is used to call the built-in function(fopen,fclose
stdlib.h
example
#include <stdio.h>
#include <stdlib.h>
___________________________________
2. FILE(available in stdio.h) type pointer
Example FILE *fp;
you need a pointer which can point your file.
it means that with help of this pointer you can track your
file, this pointer allows you to manage your file such as
opening,
reading, and writing data to/and from a file.
FILE is a structure data type(built-in):
it holds information of file such as size of file and so on.
3. NULL(it is a macro available in both stdio.h and stdlib.h) and
fopen(built in function, it is used to open the file.)
fopen() returns FILE pointer if file is open successfully
otherwise it will return NULL pointer, it means file could not be
open.
NULL pointer means no valid memory address assigned.
Example:-
FILE *fp;
fp = fopen(filename, "r");//"r" means read mode
if (fp == NULL)
{
printf("Cannot open file \n");
exit(0);
}
4. EOF(macro available in stdio.h)
it is used to detect the end of file character.
so you should read file till the end.
there is EOF character at the end of file.
and should stop the reading if reached at the end of file.
5. fclose(built in function, it is used to close the
file.)
Example:-
ch = fgetc(fp);
while (ch != EOF)
{
printf ("%c", ch);
ch = fgetc(fp);
}
difference between macro and function
___________________________________________
when function is called, control goes to the body of the
function.
after the execution of body control returns back to the normal
sequence
so, it time consuming process(to send control some where else)
when macro is used a copy is inserted in the program's
memory
so there is no need to send control anywhere.
that's why macro is faster than function.
but macro consumes more memory(due to it's insertion in
program's memory) in comparison of function.
function takes less memory.
you can put all the above things together to make a useful
program.

Please provide the required libraries,structures and data fields needed to open and read files. These files...
Programming Assignment 1 Structures, arrays of structures, functions, header files, multiple code files Program description: Read and process a file containing customer purchase data for books. The books available for purchase will be read from a separate data file. Process the customer sales and produce a report of the sales and the remaining book inventory. You are to read a data file (customerList.txt, provided) containing customer book purchasing data. Create a structure to contain the information. The structure will contain...
Write a python program to handle data from/to files (open, read/write, delete to handle data). It uses exception handling – try and except to catch and handle exceptions.
Create a class named Horse that contains data fields for the name, color, and birth year. Include get and set methods for these fields. Next, create a subclass named RaceHorse, which contains an additional field that holds the number of races in which the horse has competed and additional methods to get and set the new field. Write an application that demonstrates using objects of each class. Save the files as Horse.java, RaceHorse.java, and DemoHorses.java. Program 1 Submission Template Fields:...
You are required to open a file for input and read the data in that file into an array (named data). Use the variable size to count how many elements in the file. Create the file yourself in notepad and call it data.txt so that it has the following numbers in order: 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 Please help with this. In C please
This is for open data structures C++ 1. Read the entire input one line at a time. Then output all lines sorted by length, with the shortest lines first. In the case where two lines have the same length, resolve their order using the usual “sorted order.” Duplicate lines should be printed only once.
UNIX/LINUX: Read the man page for tcpdump and provide the command and accompanying options required to read the file named /tmp/tcpdump.dmp, suppress name resolution (avoid DNS lookups), and print each packet in both hex and ASCII. Please only respond if you know the answer.
For each problem, provide test data (as input files), MapReduce programs, and running results (screen shoots) on Hadoop. i) Write a program to read input file (an integer number per line) and remove duplicated numbers. ii) When data are transmitted from map to reduce, <key, value> will be automatically sorted in an ascending order. Write a program that can read input file (an integer number per line) and write them out in a descending order.
Question 1 (50) MapReduce For each problem, provide test data (as input files), MapReduce programs, and running results (screen shoots) on Hadoop i) Write a program to read input file (an integer number per line) and remove duplicated numbers ii) When data are transmitted from map to reduce, <key, value will be automatically sorted in an ascending order. Write a program that can read input file (an integer number per line) and write them out in a descending order.
C++ OPEN AND COPY FILES Your task is to create a simple C++ program that prompts the user for two file names, opens both files, reads the data from one file and copies that data to the other file. After this is done, the files are both closed and the program ends. 1. Your program, opencopy.cpp, needs to use both an ifstream object and an ofstream object. 2. You only need to use #include for these but make sure that...
CSC331: Data Structures NOTE: Please read the instructions carefully. If you do not understand please do not attempt to answer the question. This is Data Structure. The question is not asking to write a C++, the C++ code is already provided. The question is asking to use COMMAND PROMPT find the cpp file where the code is written, display the message “Hello World!” through COMMAND PROMPT. Then using COMMAND PROMPT to also output the message “Hello World!” into a text...