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
Jodie wants to buy a shirt regularly priced at $20. The shirt is on sale for 15% off the regular price. Which equation can be us
Kaylis [27]

Answer:

it's A

Step-by-step explanation:

you toke the price and times it by the decimal of the discount

7 0
3 years ago
Read 2 more answers
2+2^2 divided by 4+3. THIS IS A MULTIPLE CHOICE QUESTION PLEASE REMEMBER THAT option: 6, 7, 21, 67
Alex73 [517]

Answer:

6

Step-by-step explanation:

7 0
3 years ago
Read 2 more answers
This graph shows the solution to which inequality?
Ksenya-84 [330]

Answer:

The graph shows the solution of the inequality y > \frac{4}{3} x - 2 ⇒ D

Step-by-step explanation:

In the inequality,

  • If the sign of inequality is ≤ or ≥, then the line that represents it must be a solid line
  • If the sign of inequality is < or >, then the line that represents it must be a dashed line
  • If the sign of inequality is > or ≥, then the shaded area must be over the line
  • If the sign of inequality is < or ≤, then the shaded area must be under the line

From the given graph

∵ The slope of the line = \frac{2--6}{3--3} = \frac{2+6}{3+3} = \frac{8}{6} = \frac{4}{3}

∵ The y-intercept is (0, -2)

∵ The line is dashed and the shaded area is over the line

→ By using the 2nd and 3rd notes above, the line is dashed and

   the sign of inequality is >

∴ The inequality is y > \frac{4}{3} x - 2

∴ The graph shows the solution of the inequality y > \frac{4}{3} x - 2

7 0
3 years ago
If you earned $2000 in 10 mins how much would you earn in an hour?
MrRissso [65]

find out how much you earn per minute 2000/10=200

in an hour there are 60 minutes.

multiply the amount earned in a minute by the amount of minutes.

200*60=12000

So you earn $12,000 per hour

Wooow I wish I could earn that much

5 0
3 years ago
Alejandra plans to sew fringe on a scarf. The scarf is shaped rectangle. The length of the scarf is 48 inches. The width is one
aleksandr82 [10.1K]
Ok so you will be finding the perimeter of this rectangle. The formula is P(perimeter)=2L(length) + 2W(width)

so the length is 48 and the width is 1/2 of 48, and we all know that 1/2 of 48 = 24 right? so in the formula is says 2L so we will take 48 and multiply it by 2 and get 96. The same way with the width. 24 times 2 = 48 so then we add them together and get 144. Therefore the perimeter and the length of fringe that she will use (or how ever you say it) will be 144 inches.

Hope this helps!;)
5 0
3 years ago
Other questions:
  • Two florists purchased flower bouquets and vases at the same store. The first florist bought 3 flower bouquets and 5 vases for a
    14·1 answer
  • Multiple Choice: Please select the best answer.
    10·1 answer
  • How long will it take u to drive 225 miles at a speed of 25 mph
    11·1 answer
  • A garden is 5 yards 12 inches wide and 2 yards long. Write the ratio of the width to the length as a fraction in simplest form.
    15·1 answer
  • Answer the following question<br> 11+3p-7=6p+5-3p
    12·1 answer
  • A furniture company makes large and small chairs. A small chair takes 30 minutes of machine time and 75 minutes of labor to buil
    10·1 answer
  • Point D(9,-8) is reflected to D'(9,8)
    8·1 answer
  • The Spix’s Macaw eats seeds, plants, fruits, and flowers. One of these birds ate the same amount of seeds each day for 5 days. O
    5·1 answer
  • A rectangular portrait is 2 yards wide and 2 yards high. It costs $7.61 per yard to put a gold frame around the portrait. How mu
    11·2 answers
  • How to covert 37 feet to yards
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!