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
Find the slope of the graph
olga55 [171]
3/2 since you move 3 spaces horizontally (x) and 2 spaces up (y)
3 0
2 years ago
GIVING OUT BRAINLIEST HELP MEEE PLSSS
Bingel [31]
Are you cheating in a exam if you are
4 0
3 years ago
This season, Lisa's lacrosse team has won $\frac 23 of their home games (games played at Lisa's school), but just $\frac 25 of t
juin [17]

Answer:

Lisa's team have played 24 home games and 25 away games.

Step-by-step explanation:

Given:

Let x represents games played at home.

also y represent games played away.

Total number of games played = 49

∴ x+y=49 \ \ \ \  equation \ 1

Now according to given data:

Number of home games won = \frac{2}{3}

Number of away game won = \frac{2}{5}

Total games won =26

Hence

\frac{2}{3}x+\frac{2}{5}y=26\\\\\frac{2\times 5}{3\times 5}x+\frac{2\times 3}{5\times 5}y=26\\\\\frac{10}{15}x+\frac{6}{15}y=26\\\\\frac{10x+6y}{15}=26\\\\10x+6y= 26\times 15\\10x+6y = 390\\2(5x+3y)=390\\5x+3y=\frac{390}{5}\\\\5x+3y=195 \ \ \ \ equation \ 2\\

Now multiplying equation 1 by 3 we get,

3(x+y)=3\times49\\3x+3y=147 \ \ \ \ \ equation \ 3\\

Now Subtracting equation 2 by equation 3 we get,

(5x+3y=195)-(3x+3y=147)\\2x=48\\x= \frac{48}{2}=24

Substituting value of x in equation 1 we get.

x+y=49\\24+y=49\\y=49-24=25

Hence Lisa's team have played 24 home games and 25 away games.

3 0
3 years ago
Pls help me on this question
Anna35 [415]

Answer:

C

Step-by-step explanation:

7 0
3 years ago
Read 2 more answers
An online bookstore sells all paperback books for "x" dollars each. Aidan bought 7 paperback books and spent $3.95 on shipping.
aalyn [17]

Answer:

Aidan: 7x + 3.95 = y

Nina: 11x + 5.25 = y

5 0
3 years ago
Read 2 more answers
Other questions:
  • How many solutions does the equation −6a + 6a + 5 = 8 have? One Two No solution Infinite solutions
    11·1 answer
  • A ball is thrown into the air with an initial velocity of 60 ft/s. its height h in feet after t seconds is given by the function
    11·2 answers
  • Will someone please help me out with this problem I don’t remember how to do these
    12·1 answer
  • For each of the described curves, decide if the curve would be more easily given by a polar equation or a Cartesian equation. Th
    6·1 answer
  • 45 is 35% of what number?​
    9·2 answers
  • Suppose that the store manager of a small rural pharmacy is doing a linear regression of daily sales of over-the-counter (OTC) d
    12·1 answer
  • Find the total surface area of the figure below:
    12·2 answers
  • Which expression is equivalent to –3 – 3x – 1 + x 2x – 4 –2x + 4 –2x – 4? 4 – 2x
    7·1 answer
  • I need to know the answer to 1/6 +1/2 =
    14·1 answer
  • Select the correct answer from each drop-down menu. policy is the actions taken by the to influence the real gdp and the inflati
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!