RT 사진에 표시된 코드에서는 프레임 인쇄 결과가 100인데 루프 본문을 실행하지 않는 코드입니다. 반품 및 기타 진술서, 문제가 어디에 있는지 물어봐도 될까요? (라인 142의 주석 처리를 제거하면 0부터 99까지 올바르게 인쇄됩니다)
루프 본문이 실행됩니다. 로그에 0가 있는데, 이는 처음으로 s=0일 때 루프가 시작되었음을 나타냅니다.
0
프로그램이 충돌해서 실행되지 않은 것 같습니다. 마지막 오류 메시지process excited after ... with return value 3221225477
process excited after ... with return value 3221225477
문제는 149행의 fread(&block, 1, readBytesPer, fp);여야 합니다.fread(&block, 1, readBytesPer, fp);作为buff的block,其长度只有一个struct BLOCK_16bit_2channel但是读取的长度readBytesPer = sizeof(struct BLOCK_16bit_2channel) * readSamplePer버프로 사용되는 block의 길이는 struct BLOCK_16bit_2channel 하지만 읽기 길이 readBytesPer = sizeof(struct BLOCK_16bit_2channel) * readSamplePer, 여기서 readSamplePer 값은 22050*10
fread(&block, 1, readBytesPer, fp);
block
struct BLOCK_16bit_2channel
= sizeof(struct BLOCK_16bit_2channel) * readSamplePer
struct BLOCK_16bit_2channel 하지만 읽기 길이 readBytesPer = sizeof(struct BLOCK_16bit_2channel) * readSamplePer, 여기서 readSamplePer 값은 22050*10
우선
루프 본문이 실행됩니다.
로그에
0
가 있는데, 이는 처음으로 s=0일 때 루프가 시작되었음을 나타냅니다.그럼
프로그램이 충돌해서 실행되지 않은 것 같습니다.
마지막 오류 메시지
process excited after ... with return value 3221225477
충돌 원인
문제는 149행의
읽기 길이는 버프를 훨씬 초과하고 메모리 읽기 및 쓰기는 범위를 벗어났기 때문에 최종 프로그램이 중단되었습니다. 🎜fread(&block, 1, readBytesPer, fp);
여야 합니다.fread(&block, 1, readBytesPer, fp);
作为buff的
block
,其长度只有一个struct BLOCK_16bit_2channel
但是读取的长度readBytesPer
= sizeof(struct BLOCK_16bit_2channel) * readSamplePer
버프로 사용되는block
의 길이는struct BLOCK_16bit_2channel
하지만 읽기 길이 readBytesPer
= sizeof(struct BLOCK_16bit_2channel) * readSamplePer
, 여기서 readSamplePer 값은 22050*10