Pages

Wednesday, February 5, 2014

Lab # 2. From Fareed

#3
PART A = 8.18 MILISECONDS

PART B = 222 HOURS
work shown how I got # 3.


#4

fd[]- stands for file descriptor. Contains the files/information that are transmitting to each other. These are array type structure. Two are needed for each end of the pipe.

int pipe(fd)- Creates the communication between the file descriptors.

fork()- used to create processes when called. The new process will be the “child” of the caller.

pid_t- parent process ID.

#5

FILE * - pointer needed to keep of a file to add information.

fopen – opens the file to worked on. Along with fopen we use types like r, w, a, r+, ect to specify what to do with the file. Example, if we want to read only, write only, both read an write, ect.

fclose – Closes the file after you finish working on it.

fprintf, fscanf – output and input with text.

fgetc- Allows to read one text character at a time from a file.

Fputc – Allows you to type one character at a time in a file.

Sizeof() - Specifies how big you want your file.

#include<stdio.h>
#include<stdlib.h>

int main(){

FILE *fp;

int homework;

fp = fopen(“c:\\ homework.txt”, “r+”);

fclose(FILE *homework);

fprint(fp, “homework n\”);

fwrite(homework, sizeof(200));

system(“pause”);
return 0;
}



1 comment:

Note: Only a member of this blog may post a comment.