1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aalyn [17]
3 years ago
9

a. For a file whose size (in terms of number of bytes) is less than or equal to 12, then duplicate the contents of the file so t

hat its total size would be twice as many as its original size.
Mathematics
1 answer:
pickupchik [31]3 years ago
4 0

Answer:

#include <stdio.h>

int main()

{

int check;

char* dirname = "Subdir1";

check = mkdir(dirname,0766);

// check if directory is created or not

if (!check)

{

printf("Subdir1 Directory created\n");

 

char *dirname1="/Subdir1/D1";

if(mkdir("/Subdir1/D1", 0777)==-1)

{

printf("D1 Directory created\n");

int A1 = open ("/Subdir1/D1/A1.txt", 0666);

write(A1, "abcdefghij\n", strlen("abcdefghij\n"));

close(A1);

 

int A2 = open ("/Subdir1/D1/A2.txt", 0666);

write(A2, "you are beautiful\n", strlen("you are beautiful\n"));

close(A2);

 

int A3 = open ("/Subdir1/D1/A3.txt", 0666);

write(A3, "this is terrible!\n", strlen("this is terrible!\n"));

close(A3);

}

else

{

printf("Unable to create directory D1\n");

exit(1);

}

if(mkdir("/Subdir1/D2", 0777)==-1)

{

printf("D2 Directory created\n");

int B1 = open ("/Subdir1/D2/B1.ccc", 0664);

write(B1, "abcdefghij\n", strlen("abcdefghij\n"));

close(B1);

 

int B2 = open ("/Subdir1/D2/B2.ccc", 0664);

write(B2, "you are beautiful\n", strlen("you are beautiful\n"));

close(B2);

 

int B3 = open ("/Subdir1/D2/B3.ccc", 0664);

write(B3, "this is terrible!\n", strlen("this is terrible!\n"));

close(B3);

}

else

{

printf("Unable to create directory D2\n");

exit(1);

}

 

if(mkdir("/Subdir1/D3", 0777)==-1)

{

printf("D3 Directory created\n");

int C1 = open ("/Subdir1/D3/C1.txt", 0644);

write(C1, "abcdefghij\n", strlen("abcdefghij\n"));

close(C1);

 

int C2 = open ("/Subdir1/D3/C2.ddd", 0644);

write(C2, "you are beautiful\n", strlen("you are beautiful\n"));

close(C2);

 

int C3 = open ("/Subdir1/D3/C3.txt", 0644);

write(C3, "this is terrible!\n", strlen("this is terrible!\n"));

close(C3);

}

else

{

printf("Unable to create directory D2\n");

exit(1);

}

 

}

 

 

else {

printf("Unable to create directory Subdir1\n");

exit(1);

}

return 0;

}

Program 2:

#include <stdio.h>

 

long int findSize(char file_name[])

{

// opening the file in read mode

FILE* fp = fopen(file_name, "r");

 

// checking if the file exist or not

if (fp == NULL) {

printf("File Not Found!\n");

return -1;

}

 

fseek(fp, 0L, SEEK_END);

 

// calculating the size of the file

long int res = ftell(fp);

 

// closing the file

fclose(fp);

 

return res;

}

 

// Driver code

int main()

{

FILE *fptr1;

char c;

char file_name[] = {"D1.txt"};

long int res = findSize(file_name);

if (res != -1)

{

printf("Size of the file is %ld bytes \n", res);

if(res<=12)

{

fptr1 = fopen("D1.txt", "r");

c = fgetc(fptr1);

while (c != EOF)

{

fputc(c, fptr1);

c = fgetc(fptr1);

printf(c);

}

}

}

return 0;

}

You might be interested in
ms. keeling has eighty trick or treaters visit her house. twenty-five percent are vampires. fifteen percent are pirates. twenty
Gemiola [76]

Answer:

add then divide

Step-by-step explanation:

6 0
3 years ago
The 10th term of an arithmetic sequence is 10 and the sum of the first 10 terms is -35. Find the first term a1, and the common d
lina2011 [118]

The first term is − 17 and the common difference is 3

8 0
3 years ago
What is an equation of a line with the given slope and y-intercept.<br><br> m = 2, b = 6
Schach [20]

Answer:

Slope intercept form is y=2x+b

Step-by-step explanation:

5 0
3 years ago
Pls help I’ll brainlest ASAP and add extra points I’m failing
Step2247 [10]

Step-by-step explanation:

you drew already the right things, you have everything.

so, what is the problem ?

the most common form of line equation is

y = ax + b

a is the slope of the line. it is expressed as the ratio

y coordinate change / x coordinate change

when going from one point to the other.

b is the y-intercept (the y value when x = 0).

once we have the slope, we get b by using the coordinates of one of the given points as x and y in the equation and solve for b.

so, for the 2 marked points you showed correctly the differences :

x changes by +8 (from -4 to 4).

y changes by -2 (from 3 to 1).

so the slope is -2/+8 = -1/4

the y-intercept we also see directly in the chart : +2.

3 0
2 years ago
75% of what number is 200
Lerok [7]
We try to find the number that 75% of it is 200 by set the number that we try to find by A
-> A x 75/100 = 200
-> (A x 75)/100 = 200
-> A x 75 = 200 x 100
-> A x 75 = 20,000
->A = 20,000/75
-> A = 266.6666...
So that the number that 75% of it is 200 : 266.6667


4 0
2 years ago
Read 2 more answers
Other questions:
  • 30 divided by 1/2 A.15 B.20 C.40 D.60
    11·2 answers
  • The slope is -8/7 and the coordinates are (4,4).Whats the answer?
    11·1 answer
  • Slope-intercept form
    12·2 answers
  • Which number line shows the solution set for |8 - 2p| = 6
    15·2 answers
  • what is the outside surface area of an A-frame house which measures 6.5 yards wide and 5.6 yards high
    14·2 answers
  • A sequence of transformations maps angleABC to A'B'C'. the sequence of transformations that maps ABC to A'B'C' is a reflection a
    12·1 answer
  • PLEASE HELP
    13·2 answers
  • What is the volume of the pyramid in cubic inches?
    5·1 answer
  • Abe is planning on spending at most 27% of his monthly income on housing. What is the most he can spend if his he makes $71,614
    6·1 answer
  • On a fith grade benchmark exam with 55 questions total sunny answerd 80 % of them how many questions did he answer correctly
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!