Questions tagged [copy]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
36 views

fread seems to break my program

I've been spending a lot of time trying to get my head around the fread and fwrite functions. In said (vain) attempts, I made some little changes to the copy.c program that is provided as part of ...
0
votes
1answer
69 views

Why doesn't this code work?

#include <stdio.h> #include <string.h> #include <cs50.h> int main () { string s = GetString(); int n=strlen (s); string c [n]; for (int i=0; i< n; i++) { ...
0
votes
2answers
21 views

I made this copy program as in the shorts by david but it is giving two error described below

Here is the code with error message in the comments #include <stdio.h> #include <string.h> #include <cs50.h> #include <ctype.h> int main (void) { char* s=GetString(); ...
0
votes
1answer
228 views

Help with pset4 resize!

I've been working on resize.c for a day or two and I don't think I understand the code of copy.c well enough to solve the problem. I am very confused about how bf and bi just turn into pointers. In ...
2
votes
1answer
816 views

How does copy.c know which RGBTRIPLE it is supposed to copy?

I don't understand how the program knows where in the infile it is. I am imagining a sort of cursor that automatically moves to the end of what has been read by fread (is this correct?). How does ...
0
votes
2answers
169 views

How do I copy and paste to and from the appliance?

How do I copy and paste to and from the appliance ie: from my computer(host) to the appliance(guest) and visa versa? I looked at Appliance - Host Copy and paste problems, but I could not find "Shared ...
2
votes
2answers
249 views

Pset4: How does fread add properly to the struct?

In Problem Set 4 we're given the copy.c and bmp.h files. On line 47 the fread() function is called with the arguments, &bf, sizeof(BITMAPFILEHEADER), 1, and inptr. I understand what each of these ...
1
vote
2answers
942 views

Why does copy.c skip padding?

I'm having a bit of a hard time understanding certain lines of code in copy.c. For example below: // skip over padding, if any fseek(inptr, padding, SEEK_CUR); // then add it back (to demonstrate ...
1
vote
1answer
391 views

Appliance - Host Copy and paste problems

I can't correctly copy and paste from my appliance to my host, and vice versa. When I copy something from the appliance, I can paste it elsewhere in the appliance, but not outside the appliance. It ...
0
votes
2answers
175 views

Why Do We Add a char (A Byte) While We Need 3 Bytes?

In copy.c, in case we're copying a 3x3 bmp image, this piece of code adds the calculated padding to the bmp // then add it back (to demonstrate how) for (int k = 0; k < padding; k++) { fputc(...
8
votes
2answers
2k views

How does fread progress through each byte in copy.c?

In copy.c (and the other apps using the same start code), how does freed know to read one byte after another? It seems to just do it automatically. Eg, this will read each byte, from first until bi....