小编Pyr*_*ons的帖子

合并多个.mp3文件

在mac/linux上有一个将mp3文件合并在一起的命令

cat file1.mp3 file2.mp3 > newfile.mp3
Run Code Online (Sandbox Code Playgroud)

我想知道是否有更简单的方法或命令来选择文件夹中的多个mp3并将其作为单个文件输出?

audio macos

5
推荐指数
1
解决办法
2973
查看次数

#在C语言的一行中定义多个常量

是否可以#define在C中将几个预处理器命令放在一起?

例如,代替此:

#define a 1
#define b 2
#define c 3 ...
Run Code Online (Sandbox Code Playgroud)

只是这个:

#define a1, b2, c3 
Run Code Online (Sandbox Code Playgroud)

c c-preprocessor

3
推荐指数
2
解决办法
639
查看次数

在C中重用内存

我在使用和理解C中的free()函数时遇到了问题.

我尝试编写这个例子以继续重用指针,但我不明白为什么会出现错误:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>


typedef struct box
{
    char message[20];
}box;


box *newBox()
{
    box *inBox;
    inBox = (box *) malloc(sizeof(box));

    return inBox;
}


int main()
{
    box *temp = NULL;


    temp = newBox();
    strcpy(temp->message,  "Hello");
    printf("%s\n", temp->message);

    free(temp);

    strcpy(temp->message,  "World");
    printf("%s\n", temp->message);

    free(temp);

    strcpy(temp->message,  "People");
    printf("%s\n", temp->message);

    return 0;   

}
Run Code Online (Sandbox Code Playgroud)

输出是:

Hello
World
memory(531,0x7fff77e9e300) malloc: *** error for object 0x7fe8ba404a90: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort …
Run Code Online (Sandbox Code Playgroud)

c memory pointers

0
推荐指数
1
解决办法
193
查看次数

0
推荐指数
1
解决办法
1000
查看次数

标签 统计

c ×3

audio ×1

c-preprocessor ×1

macos ×1

malloc ×1

memory ×1

pointers ×1