Questions tagged [lab4]
The lab4 tag has no usage guidance.
15 questions
0
votes
1
answer
182
views
Lab 4 Smiley - I can't change the color of pixels
#include "helpers.h"
void colorize(int height, int width, RGBTRIPLE image[height][width])
{
// Change all black pixels to a color of your choosing
for (int i = 0; i < height; i++)...
0
votes
1
answer
80
views
Lab 4 using feof() function
I am getting problems with check50. My program differs from solution only in while condition, where I am using feof() function instead of fread(). feof() function returns a non-zero value when End-of-...
0
votes
1
answer
183
views
Lab 4 volume understanding fopen() & fwrite()
in volume you have to fread() and fwrite() a wav file from an input to an output an alter the volume via a factor n.
You first fwrite a header of size 44 bytes to a file output.wav with the help of an ...
0
votes
1
answer
39
views
Lab4 fread() and fwrite() problem
can anybody tell me what is wrong with this code block. When i use check50 it fails all three objectives.
h_buffer: header buffer
s_buffer: sample buffer
// TODO: Copy header from input file to output ...
1
vote
1
answer
42
views
Lab 4 - header vs &header
'''
const int HEADER_SIZE = 44;
uint8_t header[HEADER_SIZE];
// with &
fread(&header, HEADER_SIZE, 1, input);
fwrite(&header, HEADER_SIZE, 1, output);
// without &
fread(header, ...
1
vote
0
answers
104
views
Lab 4 not altering output file - using solution word for word
I have looked at all the solutions here on the exchange. I have two issues. Firstly:
const int HEADER_SIZE = 44;
This does not work for me in the context of initializing a header array. I either have ...
0
votes
1
answer
138
views
lab 4: volume question
I was wondering if someone could help explain why an while loop cannot be used for the copying of the header for the .wav file. I originally used a while loop like the one from the cp.c in the ...
0
votes
1
answer
249
views
lab 4 is not passing check50, but the volume is changing by the factor when we listen to the audio
// Modifies the volume of an audio file
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// Number of bytes in .wav header
const int HEADER_SIZE = 44;
int main(int argc, ...
0
votes
1
answer
18
views
unit16_t error while including library
Declaring Header is causing an error although <stdint.h> library is originally included in the distribution file, please help.
Thanks in Advance.
0
votes
2
answers
232
views
Lab 4 problems when the audio is clearly altered
Source file:
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// Number of bytes in .wav header
const int HEADER_SIZE = 44;
int main(int argc, char *argv[])
{
// ...
0
votes
2
answers
293
views
Why do you not need to allocate memory for int16_t in Lab4, volume?
Why, when setting up the buffer below, do you not need to use malloc to set aside memory for it? My code works fine, I just want to understand this a little better. Thanks, in advance, for the help.
...
1
vote
0
answers
87
views
Lab4 Volume, question about copying samples from input to output wave file
First of all, thank you for taking the time to read my question. I have actually completed Lab 4, Volume, and received full points on the assignment, however, there is one part of the code that I don'...
0
votes
1
answer
184
views
Lab4 trouble multipliying int16_t types
I think i managed to copy the header successfully, but when trying to compile now that i wrote the rest of the code i get the following error:
volume.c:51:19: error: assigning to 'int16_t *' (aka '...
0
votes
2
answers
2k
views
Problems with Lab4
everybody.
I'm having problems with the Lab4 exercise.
I've coded this for the TODO functions:
// TODO: Copy header from input file to output file
HEADER header;
while (fread(&header, ...
0
votes
1
answer
236
views
How can I know number of samples to add it as an argument for fread and fwrite?
I'm so confused about fread and fwrite. In lab 4 " Volume", how can I know the number of samples in the input wav file? i=I need to use fread(buffer , size , qty , file operator ). So how ...