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
Plsss Helpppp!
vfiekz [6]

Answer:

11/12 = 3/4

Step-by-step explanation:

sorry that's the only one I know :(

5 0
3 years ago
Two-digit natural numbers are formed, with replacement, from the digits 0 through 9.
alexdok [17]

Answer:

The first digit of a two digit number can be any of digits 1 - 9. It cannot be 0 though. Therefore there are 9 possible digits for the first place.

There are 5 possible digits for the second position. The two digit number has to be odd and therefore the final digit must be 1,3,5,7 or 9

Therefore for each and every one of the nine first digits there are 5 digits that the second can be.

Therefore ANSWER = 9 * 5 = 45 possible permutations.

2. The largest two digit number = 99

Subtract 57 and you get 42

ANSWER = 42

The forty two numbers are 58 ,59, 60, 61......98, 99

7 0
3 years ago
Read 2 more answers
What is the answer to these questions---
shutvik [7]
1. w= 52
2. x= 5
3. n=1.4
4. x= -28/9 or x=-3.1
5 0
3 years ago
How would i etimate the first digit of the quotient
Sergio039 [100]
first you have to look to the right of that number .check if it is more than 5. if it is ,than add one to the first digit in the quotient. all the other numbers will turn to zeroes.
6 0
3 years ago
(50 points) URGENT <br> Can someone help me with this problem?
34kurt

Answer:

bit.^{}ly/3a8Nt8n these are the answers

7 0
3 years ago
Other questions:
  • Of 350 students at school, 46% are female. What is the total number of female students at the school?
    9·1 answer
  • Lamar spent $16.25 on peanuts.if he bought 2.6 pounds of peanuts,how much does one pound of peanuts cost
    9·2 answers
  • Urgent please help!!
    11·1 answer
  • $13:50 to 6 pounds what the ratio
    14·1 answer
  • Solve it using quadratic formula.<br><br><br>grade 9<br>10 points​
    13·1 answer
  • Suppose that the probabilities are 0.4, 0.3, 0.2, and 0.1, respectively, that 0, 1, 2, or 3 power failures will strike a certain
    9·1 answer
  • A boy at an amusement park has 65 ride tickets. Each ride on the roller coaster costs 7 tickets. After riding the roller coaster
    8·1 answer
  • Pls ANWSER pls pls pls I’ll get brainly
    10·2 answers
  • Find the HCF of the following by<br>Pime factorisation.<br>a) 72,54,27<br>b) 24, 16, 36​
    13·2 answers
  • PLEASE SOLVE ALL OF THE QUESTIONS IN FULL
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!