在mac/linux上有一个将mp3文件合并在一起的命令
cat file1.mp3 file2.mp3 > newfile.mp3
Run Code Online (Sandbox Code Playgroud)
我想知道是否有更简单的方法或命令来选择文件夹中的多个mp3并将其作为单个文件输出?
是否可以#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中的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) 如果我错了就纠正我,但可以
malloc(1) // Mallocing 1 which is a int
Run Code Online (Sandbox Code Playgroud)
等于
malloc( sizeof(1) )
Run Code Online (Sandbox Code Playgroud)