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
Multiply.<br><br> (3x+2)(2x−5)<br><br><br> 6x^2+4x−3<br> 6x^2−10<br> 6x^2−11x−10<br> 6x^2−13x−3
Serjik [45]

Answer: Heyaa! ^^

Your Answer when multiplied is.. 6x²−11x−10

Step-by-step explanation:

  • 6x^2−11x−10
  • Expand the polynomial using the FOIL method.

                    - FOIL EXPLANATION -

  • A handy way to remember how to multiply two binomials.

It stands for "First, Outer, Inner, Last"

  • - It is the sum of: -

· multiplying the First terms,

· multiplying the Outer terms,

· multiplying the Inner terms, and

· multiplying the Last terms

<em>Hopefully this helps you! ~</em>

6 0
2 years ago
which one of the following examples represents a repeating decimal A. 1.111114 B. 0.777777 C. 4.252525 D. 0.123123
elena-s [515]
Actually, i think something is missing here:

You need either a parenthesis or some dots at the end to determine this. A repeating decimal can have one repreating digit:

0.(7): 0.777777...

two:

0.(45): 0.45454545454545....

or more: so potentially all of them can be repeating, even a!

it could be: 1.(111114)

or: 1.111114111114111114111114111114111114111114111114111114111114111114111114111114...

proably B. is the most typical of repeating decimals (choosed this one if you have to), but in reality, you need more information... did you copy the question exactly?
7 0
3 years ago
Which of the following will form the composite function?
zhuklara [117]

Answer:

B

Step-by-step explanation:

In the composition of <em>f</em><em> </em>and <em>g</em>, the equation is telling us to place the function <em>f</em> inside <em>g</em>. Observing in B that <em>f</em> is (x + 4), then this can be put in place of the x in 3x^2, making it 3(x + 4)^2 and finally the minus 5.

5 0
3 years ago
Here is a five-sided polygon. Describe or show the strategy you would use to find its area. Mark up and label the diagram to sho
MrRissso [65]

Answer:

i can explai it to u if u wan to get the answer

Step-by-step explanation:

Divide the polygon into 5 triangles by using each side as a base and joining the vertices of the polygon to a common point (for example, the centre). If the polygon is regular the angle at the vertex of each triangle is 360/5=72 degrees, so you have 5 isosceles triangles of equal area. Find the area of one and multiply by 5 to get the total area.multiply 5 times the lenght of oneside

6 0
3 years ago
A pair of shorts costs $36. it is on sale for 25% off . what is the final price ?
maria [59]
You just do 36*.25=9
Then 36-9=27

$27 is your final price

Hope this helps!

Please crown;)
5 0
3 years ago
Read 2 more answers
Other questions:
  • What is the value of x in the equation −6 + x = −1? (10 points)
    12·2 answers
  • Whats another way to represents the ratio 40:1?
    14·1 answer
  • A pipe can fill a tank in 120 minutes while the drain can drain it in 150 minutes. If the drain is left open and the fill pipe i
    11·1 answer
  • Use compatible number to estimate the quotient 23.6 ÷7
    10·1 answer
  • 3x+4 greater than 16
    13·1 answer
  • Using the numbers -4, 10, 8, 2, -3, -5, create two expressions that equal 6
    6·1 answer
  • PLEASE HELP PLEASE I NEED IT TODAY
    10·1 answer
  • What a fraction has numerator 12 and is equivalent 3/4?<br> 9/12<br> 12/13<br> 9/16 or 12/16
    6·2 answers
  • What is the answer????
    10·2 answers
  • 12 minus half the sum of 6 and 4​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!