小编tes*_*ter的帖子

<xsl:template match="/*"> 和 <xsl:template match="*"> 的区别

你能解释一下这两者之间的区别吗

<xsl:template match="/*">
Run Code Online (Sandbox Code Playgroud)

<xsl:template match="*">
Run Code Online (Sandbox Code Playgroud)

<xsl:template match="/">
Run Code Online (Sandbox Code Playgroud)

看看比赛规则:)

非常感谢您的帮助!

xslt match

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

C exit()函数 - 它的作用是什么?

我在学习C.

如果我:

void fun(){
      exit(0);
}

void main(){
    /*instructions*/
    fun();
    /*other-instructions*/
}
Run Code Online (Sandbox Code Playgroud)

当调用函数"fun"时,我退出(0).一旦退出(0)执行,它会关闭所有内容吗?或其他指令执行?exit(0)和exit(-1)之间的区别是什么?我是否必须#include一些东西来使用退出功能?

谢谢你的帮助!

c exit

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

哪个字符集是'&amp; lt;'?

我在phpbb数据库中找到了这个字符:&amp;lt;.哪个字符集是?

我在MySQL上,我有PhpBB和phpmyadmin.代码显示<.

mysql character-encoding

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

C while(条件); 体内无指令

我正在学习C,我对while有疑问。在一次练习中我已经:

while(1){
   while((sockacc = accept(ds_sock,&client,&length)) == -1);

   --other instructions--
}
Run Code Online (Sandbox Code Playgroud)

谁能告诉我第二个while的功能是什么?我的意思是,我知道接受呼叫的用途。我不明白如果体内没有任何东西,为什么要使用 while 条件。

c while-loop

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

Printf在C程序中有异常行为

我在Ubuntu上用C创建一个服务器,但是我的printf函数问题不起作用.这是代码.我希望终端在程序启动时立即打印"dd",但它什么都不做.建议?

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

void main(){
printf("dd");
int ds_sock;
struct sockaddr_in my_addr;
ds_sock=socket(AF_INET,SOCK_STREAM,0);

memset(&my_addr,0,sizeof(my_addr));
my_addr.sin_family=AF_INET;
my_addr.sin_port=htons(25000);
my_addr.sin_addr.s_addr=INADDR_ANY;

bind(ds_sock,(struct sockaddr *)&my_addr,sizeof(my_addr));

listen(ds_sock,3);
printf("dd");
int ds_sock_acc;
struct sockaddr_in addr;
size_t sin_size = sizeof(struct sockaddr_in);
ds_sock_acc = accept(ds_sock,(struct sockaddr *)&addr,&sin_size);
while(ds_sock_acc==-1) {
    printf("connessione non riuscita");
    ds_sock_acc = accept(ds_sock,(struct sockaddr *)&addr,&sin_size);
}
printf("connessione riuscita");
close(ds_sock);
close(ds_sock_acc);
}
Run Code Online (Sandbox Code Playgroud)

这个(客户端)按预期工作:

void main(){
printf("dd");
int ds_sock;
ds_sock = socket(AF_INET, SOCK_STREAM,0);

int ret; …
Run Code Online (Sandbox Code Playgroud)

c printf

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

malloc,memset和免费正确用法

我使用malloc,memset和free时遇到问题,这不能按预期工作.问题在于最新的printf功能,而不是打印"test",它打印一些奇怪的字符,然后进行测试,比如"@#°test".你能解释我为什么吗?我注意到如果我在第二个malloc之后做了一个memset,一切正常.另外,即使没有memset,如果我不调用函数"function()",我真的不明白为什么一切正常

这是我的代码:

#define size 10
void function(){
   ...
   ...other code...
   ...
   char *b=malloc(size);
   read(file_ds,b,size); //file_ds stands for file descriptor, correctly opened with open function.
   memset(b,0,size);
   free(b);
}

void main(){
   ...
   ...other code...
   ...
   function(); //If I don't call this, everything works fine, even without a memset
   char *c=malloc(size);
   strcat(c,"test");
   printf("%s",c);
}
Run Code Online (Sandbox Code Playgroud)

c malloc free memset

-1
推荐指数
1
解决办法
641
查看次数

标签 统计

c ×4

character-encoding ×1

exit ×1

free ×1

malloc ×1

match ×1

memset ×1

mysql ×1

printf ×1

while-loop ×1

xslt ×1