linux c ±àÒëͨ²»¹ý£¬Çë¸ßÊÖ°ïÎÒ¿´ÏÂÄÄÀïµÄ´í£¿
int _send()
{
int fd,size;
char fname[1024],buffer[4096];
/*ÊäÈëÒª´«ÊäµÄÎļþ*/
printf("ÇëÊäÈëÄúÒª´«ÊäµÄÎļþ·¾¶:\n");
gets(fname);
/*´ò¿ªÎļþ*/
fd = open(fname,O_RDONLY,0);
/*¶ÁÈ¡Îļþ*/
while((size = read(fd,buffer,4096))>0)
{
/*µ÷ÓÃclientº¯Êý£¬´«ÊäÎļþ*/
// client(buffer);
printf("%s",*buffer);
}
if(size == -1)
{
fprintf(stderr,"Read Error: %s\a\n",strerror(errno));
exit(-1);
}
/*´«Êä½áÊø,¹Ø±ÕÎļþ*/
close(fd);
printf("´«ÊäÍê±Ï£¡\n");
£ý
/*ÎÒÓÃgcc -c clien client.c±àÒ룬
*Ìáʾ´íÎóÐÅÏ¢:
*
*client.c: ÔÚº¯Êý¡®_send¡¯ÖУº
*client.c:58: ´íÎó£º ÔÚµ÷ÊÔÆ÷ÀïÖØÐÂÔËÐд˳ÌÐò
*client.c:58: ´íÎó£º ÔÚµ÷ÊÔÆ÷ÀïÖØÐÂÔËÐд˳ÌÐò
*client.c:58: ´íÎó£º ÔÚµ÷ÊÔÆ÷ÀïÖØÐÂÔËÐд˳ÌÐò
*client.c:58: ´íÎó£º expected declaration or statement at end of input
*/
ÊDz»ÊÇûͷÎļþ°¡
printf("%s",*buffer); ÕâÀïÊDz»ÊÇ´íÁË
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <sys/socket.h>
Í·Îļþ¡£
{{--
Ïà¹ØÎÊ´ð£º
C\C++ÈçºÎ¼ÆË㺯ÊýµÄµ¼Êý,±¾ÈËÐÂÊÖ£¬Ïëд¸ö³ÌÐò£¬µ«ÊDz»ÖªµÀÈçºÎÏÂÊÖ£¬»¹Íû¸ßÊÖÖ¸µãÒ»¶þ£¬Ð»¹ý¡£
Õâ¸ö¡¡
¸úº¯ÊýµÄ¾ßÌåÐÎʽÓйذɣ¬ÄѵÀÄãÏë±à³ö¸ö¡°ÍòÄÜ¡±µÄÇ󵼺¯Êý£¿
°³ÉÏѧʱÏë¹ý×Ô¶¯ÍƵ¼¹«Ê½£¬ºóÀ´ ......
ÎÊһϣº
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
´ó¼ÒºÃ£¡ÎÒÊÇһλC°®ºÃÕߣ¬Ïò´ó¼ÒÇë½ÌÏ£¬C³ÌÐòÔ±¿ÉºÃÕÒ¹¤×÷£¿¹«Ë¾ÓÃC¸ÉЩʲô£¿
ÎÞËùνºÃ²»ºÃÕÒ¹¤×÷£¬Ò»°ãͨÐÅ¡¢ÏµÍ³¡¢Ç¶Èëʽ¡¢Ó²¼þ·½ÃæÓõĶ࣬¶øÇÒÓÉÓÚCµÄµ×²ãÌØÐÔ£¬Ñ§»áºóÔÚѧÆäËûµÄ»á±È½ÏÈÝÒ×
²»¹ÜÓÃʲôÓï ......
¹¤×÷ÄÚÈÝ Ñз¢
×ʸñÒªÇó£º
211ºÍÖصãԺУ±¾¿Æ 3Ä깤×÷¾Ñé
211ºÍÖصãԺУ˶ʿ 1Ä깤×÷¾Ñé
ÆÕͨԺУÔÚ¹¤×÷ÄêÏÞÉϸ÷¼Ó1Äê
ÓÐͨÐÅÏà¹Ø¿ª·¢¾ÑéÕßÓÅÏÈ£¬µ±È»C/C++ »ù´¡ÒªÔúʵ
à ......