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
The parallelograms are similar. Find x.
amid [387]

Answer:

40

plss mark me brainliesttt

Step-by-step explanation:

4÷1/2=8

5×8=40

7 0
2 years ago
Suppose you like to keep a jar of change on your desk. Currently, the jar contains the following:
antoniya [11.8K]

Answer:

The probability is 435/6,806

Step-by-step explanation:

Firstly, the total number of coins in the jar is

13 + 15 + 29 + 26 = 83

The probability of selecting a dime is 15/83

Now we want to grab a nickel

Since we already selected a dime and we did not replace it, the number of total coins in the jar will be 83-1 = 82

So the probability of selecting a nickel this time is

29/82

So the total probability of the event in the described order is;

15/83 * 29/82

= 435/6,806

4 0
2 years ago
Add 1/8 + 3/8<br><br> A. 3/64<br> B. 4/64<br> C. 4/16<br> D. 4/8
Luden [163]

the answer is........ D

7 0
3 years ago
What is the quotient of 560 and 7?
natka813 [3]
Quotient is Latin for "how many times" and it is the answer to a division problem.

560/7=80

we can prove this by doing it backwards

7*80=560
3 0
2 years ago
Find the missing number in each sequence<br> Will give Brainliest
jok3333 [9.3K]

Answer:

8. 24.5

9. 29.6

Step-by-step explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • a deli served 1288 sandwiches in 4 weeks. if it served the same number of sandwiches each day,how many sandwiches did it serve i
    10·1 answer
  • Which of the following best describes the volume of a cylinder?
    8·1 answer
  • The dimensions of a triangular prism are shown in the diagram.
    7·2 answers
  • What are the roots of this quartaic equation?<br> -102 + 12r - 9 = 0
    5·2 answers
  • The average value of a function f over the interval [−2,3] is −6 , and the average value of f over the interval [3,5] is 20. Wha
    9·1 answer
  • Help ! please ! with 13, 14, 15, 16, 17, 18, 19, 20, 21,
    14·1 answer
  • Find he prodct <br> 4(-2)
    7·2 answers
  • Simplify: 121/11 + 3(4)/2<br> Please and thank you. :)
    9·1 answer
  • What are the X - and y-intercepts of the equation 7x + 3y = 21 ?
    15·1 answer
  • I will give branly to the best and fast answer :D
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!