小编Hok*_*rie的帖子

在Bash中打印文件的最后修改日期

我似乎无法找到如何打印出文件的日期.我到目前为止能够打印出目录中的所有文件,但我需要用它打印出日期.

我知道我需要在条目的回显处添加日期格式,但是我找不到正确的格式.

echo "Please type in the directory you want all the files to be listed"

read directory 

for entry in "$directory"/*
do
  echo "$entry"
done
Run Code Online (Sandbox Code Playgroud)

unix bash shell date file

124
推荐指数
5
解决办法
15万
查看次数

在MySQL Workbench中将数据从一个模式导出到另一个模式

有没有办法将表和数据从一个模式导出到另一个模式?管理导入/导出选项要求我选择要连接的服务器,该服务器显示为空白.我目前已连接到我学校租用的服务器,专门用于此类,因此我没有任何管理员权限.

mysql schema export mysql-workbench

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

在 C 中保持套接字打开

我认为这可能是一个简单的解决方案,我只是想太多了。我正在编写一个非常基本的聊天程序,其中客户端和服务器轮流发送消息。现在,我只来回发送消息一次,然后客户端关闭套接字。该程序不必同时打开套接字,只要它可以像秋千一样来回切换即可,而不是真正的聊天程序,它可以同时接受双方的多个输入。

客户端中的 while 循环会保持打开状态吗? while 循环的条件是什么?

我尝试了几种不同的条件,但没有一个起作用......它只是让它挂起。我还尝试注释掉close()服务器代码中的一些函数,但这也不起作用。

我还有一个小问题,即接收到的输入打印乱码,但我认为这是因为它在字符串数组中没有任何内容时打印字符串数组的内存地址......我只是不记得如何缩短它。哈哈。

服务器.c:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <signal.h>

#define PORT "3490"  // The port users will be connecting to

#define BACKLOG 10   // How many pending connections queue will hold

char input[20];
char *pointer;

void sigchld_handler(int s)
{
    while(waitpid(-1, NULL, WNOHANG) > 0);
}

// Get sockaddr, IPv4 or IPv6:
void *get_in_addr(struct sockaddr …
Run Code Online (Sandbox Code Playgroud)

c sockets parent-child

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

bash ×1

c ×1

date ×1

export ×1

file ×1

mysql ×1

mysql-workbench ×1

parent-child ×1

schema ×1

shell ×1

sockets ×1

unix ×1