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
Determine the x- and y-intercepts of the graph of y=1/4x−2 .
KATRIN_1 [288]
To find the x-intercept, put in 0 for the y.

0=1/4x-2
2=1/4x
8=x

The x-intercept is 8. The point is (8, 0).

To find the y-intercept, put in 0 for the x.

y=1/4(0)-2
y=0-2
y=-2

The y-intercept is -2. The point is (0, -2).

To graph, find the points on a coordinate plane and draw a straight line through them.

Hope this helps!
5 0
3 years ago
What is u = kx + ух, for x
Ivahew [28]

Answer:

<h2>x=  \frac{u}{k + y}</h2>

Step-by-step explanation:

u = kx + ух

First of all factorize x out at the right side of the equation

That's

u = x(k + y)

Divide both sides by ( k + y) to make x stand alone

That's

<h3>\frac{x(k + y)}{k + y}  =  \frac{u}{k + y}</h3>

We have the final answer as

<h3>x =  \frac{u}{k + y}</h3>

Hope this helps you

6 0
3 years ago
the diagram, JG = 5 cm and GE = 10 cm. Based on this information, can G be a centroid of triangle HJK?
SIZIF [17.4K]
Point G cannot be a centroid because GE is wider that JG or JG is shorter than GE. So in this diagram GE is wider than JG with 10 cm and 5 cm respectively based on this information Point G cannot be a centroid of triangle HJK. So the answer is point G cannot be a centroid because JG is shorter than GE.
4 0
2 years ago
Read 2 more answers
Hurry Please! :)
Sladkaya [172]
Area = b*h and in some cases * 2 so you need to do this, 64*52 + 40*28= 4448 yd2
8 0
3 years ago
Read 2 more answers
Suppose that in a casino game the payout is a random variable X . If X is positive, you gain money, if negative, you lose.
Vanyuwa [196]

Answer:

the conditional probability that X = 1 , X = 2 and X = 3 is  0.7333 (73.33%) , 0.25 (25%) and 0.0167 (1.67%) respectively

Step-by-step explanation:

a player wins money when i>0 then defining event W= gain money , then

P(W) = p(i>0) = p(1)+p(2)+p(3)

then the conditional probability can be calculated through the theorem of Bayes

P(X=1/W)= P(X=1 ∩ W)/P(W)

where

P(X=1 ∩ W)= probability that the payout is 1 and earns money

P(X=1 / W)= probability that the payout is 1 given money was earned

then

P(X=1/W)= P(X=1 ∩ W)/P(W) = P(X=1) / P(W) = p(1) /[p(1)+p(2)+p(3)] = 11/40 /(11/40+3/32+1/160 ) = 0.7333 (73.33%)

similarly

P(X=2/W)=p(2) /[p(1)+p(2)+p(3)] = 3/32 /(11/40+3/32+1/160 ) = 0.25 (25%)

P(X=3/W)=p(2) /[p(1)+p(2)+p(3)] = 1/160 /(11/40+3/32+1/160 ) = 0.0167 (1.67%)

8 0
3 years ago
Other questions:
  • The graph shows a proportional relationship.What is the unit rate? Enter your answer as an improper fraction in simplest form in
    6·1 answer
  • Please Help!
    13·2 answers
  • Billy was counting the number of wheels and bike seats at the playground. He saw tricycles and bicycles. He counted 79 wheels an
    6·1 answer
  • Cain measured his couch and found it is 3 3/4 meters long what is the length as a decimal
    6·1 answer
  • Evaluate the function for h(1) <br><br> h(x) = |1 – 7x|
    9·1 answer
  • Help plz..And No links!! I repeat No links!!
    14·1 answer
  • Suppose you drop a tennis ball from a height of 15 feet.
    13·1 answer
  • 1. Three people went to lunch at a buffet restaurant that charges $9.99 per
    8·2 answers
  • Please answer the question as best as you can :)
    9·1 answer
  • Find the coordinates of point U.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!