如何用xcode中的换行符替换^ M?

时间:2017-07-05 04:22:55

标签: xcode indentation

我从链接中复制了示例代码并粘贴在XCODE中,所有代码都以单行显示。我试过以下:

  

选择所有代码 - >右键单击 - >结构 - >重新缩进

但没有影响。任何人都可以请求帮助,以便我可以在没有人工努力的情况下重新缩进它。

#include <pthread.h> #include <stdio.h> #include <stdlib.h> int MAX = 10; int count = 0; pthread_mutex_t mutex; pthread_cond_t cond; void *even(void *arg) { while(count < MAX) { pthread_mutex_lock(&mutex;); while(count % 2 != 0) { pthread_cond_wait(&cond;, &mutex;); } printf("%d ", count++); pthread_mutex_unlock(&mutex;); pthread_cond_signal(&cond;); } pthread_exit(0); } void *odd(void *arg) { while(count < MAX) { pthread_mutex_lock(&mutex;); while(count % 2 != 1) { pthread_cond_wait(&cond;, &mutex;); } printf("%d ", count++); pthread_mutex_unlock(&mutex;); pthread_cond_signal(&cond;); } pthread_exit(0); } int main() { pthread_t t1; pthread_t t2; pthread_mutex_init(&mutex;, 0); pthread_cond_init(&cond;, 0); pthread_create(&t1;, 0, &even;, NULL); pthread_create(&t2;, 0, &odd;, NULL); pthread_join(t1, 0); pthread_join(t2, 0); pthread_mutex_destroy(&mutex;); pthread_cond_destroy(&cond;); return 0; }

0 个答案:

没有答案