Questions tagged [buffer]
A buffer is temporary storage for data or information
14
questions
0
votes
1
answer
47
views
pset1 credit; buffer overflow when converting to char array
My initial idea for the credit problem was to convert the long from get_long into a char array, in order to obtain something iterable to get each digit for Luhn's algo.
I recognize that this could be ...
0
votes
0
answers
142
views
Help with some understanding - Recover
I don't want an explicit solution, but some clarity in my understanding.
1) The buffer. Is using a char or int buffer a hack approach? I thought about typedef byte or block but what's the ...
0
votes
1
answer
306
views
Pset 4 : Recover, Segmentation fault
I am having problems identifying where i have gone wrong in the below code. On running the program i am getting segmentation fault. i have gone through many related tags and answers but cant ...
1
vote
1
answer
556
views
CS50 pset4 recover: buffer type and fseek questions
I have figured out a solution to recover, but my first attempt did not work. I'd like to understand a couple of things from my original attempt so I don't repeat the same errors in future code.
...
1
vote
1
answer
936
views
PSet4, resize.c. Stuck on solution using malloc (recopy)
I am trying to solve pset4/resize.c using the recopy method (i.e. allocating memory and using a buffer to write the line to it and then repeat it).
However the final picture only shows black with a ...
0
votes
1
answer
728
views
Data Type to be used in Buffer for Recover (PSET4)
I'm having a bit of trouble with making the buffer while making recover on PSET4. I have tried a couple different things, but I keep getting the same error regardless of the fix I try:
recover.c:25:...
0
votes
1
answer
489
views
pset4 malloc() approach. Help with size of buffer
I'm having some trouble with the malloc function.
I want to make a buffer the size of the new row I'm going to write in the resized file, and this is my approach.
I must say that bi.biWidth is ...
0
votes
1
answer
352
views
pset4 "resize" scanline vertical copies
after days of confusion and reading all the questions posted on this problem I thought I finally understood however I'm still doing something wrong. I believe it revolves around my use of "RGBTRIPLE ...
0
votes
2
answers
285
views
Command line argument - buffer over read
It was discussed one of the starting lectures that when using main method with command line arguments (int argc, string argv[]) then argv can be used to access memory location which is not intended to ...
0
votes
1
answer
199
views
|Recover creates only 8 files | fread | pset4|
I'm stuck with recovery program in the pset4. My program recovers 8 files. I can not find out what is wrong with it...
Here is the link on Dropbox to the code I'm using.
If you notice any error ...
8
votes
1
answer
913
views
Help me write sexier code : ) counters as pointers, buffering files, feof, sprintf [pset4.recover]
I have completed the pset, and am happy with my code and how it works. But had some design questions so that I know for future programs what and why to use.
I understand that it does not really ...
0
votes
1
answer
469
views
fread not putting what I expect in buffer
for Pset4, recover, I'm trying to read 4 bytes from card.raw into a buffer. I''m testing the first 4 bytes of card.raw with what my buffer contains using gdb, and I'm not getting the same thing. I ...
4
votes
1
answer
3k
views
What data structure do you use to store the buffer in recover?
What data structure do I use to store the 512B blocks in a buffer?
Thinking about an array or ints? Or am I completely off?
1
vote
1
answer
873
views
Pset 5 - Recover
Having problems with recover (pset5) now. This is what I'm doing:
Opening File
Until the end of file
Reading 512 bytes to buffer
Checking first 4 bytes of buffer to see if a jpg has just ...