Questions tagged [copy]
The copy tag has no usage guidance.
12 questions
0
votes
1
answer
499
views
Copy and paste from cs50.harvard.edu pages to VS code
When I copy a command from a page like https://cs50.harvard.edu/x/2022/psets/1/cash/ , then hit CTRL+V in my VS Code terminal to paste, I just get ^V instead of the text I copied. It looks like there ...
1
vote
2
answers
1k
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 ...
0
votes
1
answer
151
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
1
answer
229
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 ...
0
votes
1
answer
72
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
2
answers
27
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();
...
2
votes
1
answer
928
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
2
answers
254
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
2
answers
607
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
1
answer
573
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 ...
9
votes
2
answers
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....
0
votes
2
answers
220
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(...