Linux±à³Ì--fopenº¯ÊýµÄÓ÷¨£¿
ÇëÎʸ÷λ¸ßÊÖ£ºC±à³ÌÖеÄfopenº¯Êý,ÔÐÍÊÇ fopen(const char *filename,const char mode),ÇëÎÊÔÚʹÓÃÕâ¸öº¯Êýʱ£¬ÒªÏë´ÓLinuxÖÕ¶ËÊäÈëÎļþÃûºÍmode£¬¸ÃÈçºÎ´¦Àí£¿Ð»Ð»£¡£¡
ÊéÉϽâÊÍfilenameʱ˵£¬filename¿ÉÒÔËùÎļþÃû£¬Ò²¿ÉÒÔÊÇ°üÀ¨Îļþ·¾¶µÄÎļþÃû£¬ÖÕ¶ËÊäÈëÎÒÓÃÁËgetsº¯Êý£¬µ«ÊÇÔÚÖ´Ðе½fopenº¯Êýʱ£¬³öÏֶδíÎó£¬ÎÒÏëʵÏÖµÄÊÇ£¬´ÓÖÕ¶ËÊäÈëÎļþÃû´æ´¢ÔÚstrÖУ¬È»ºófopen(str,mode),ÇëÎÊÎÒ¸ÃÈçºÎ²Ù×÷ÄØ£¿
modeÆäʵÊÇÒ»¸öconst char£¬ËùÒÔÐèÒªÒ»¸öchar*À´±£´æ£¬filenameÒ²Ò»Ñù°¡¡£
²»¹ýÐèÒª¼ì²éÕâÁ½¸öÊäÈëstringµÄºÏ·¨ÐÔ£¬²»È»»á³ö´í¡£
¹©²Î¿¼£º
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
char filename[20],mode[5];
FILE * fHandle = NULL;
memset(filename,'\0',20);
printf("input filename:");
scanf("%s",filename);
printf("\ninput mode string:");
while(1)
{
memset(mode,'\0',5);
scanf("%s",mode);
/*For example:only need "w" mode for fopen */
if(strcmp(mode,"w"))
{
printf("invalid mode,please input again:\n");
&nb
Ïà¹ØÎÊ´ð£º
¸ç¸ç½ã½ãÃÇ£¬£¬£¬ÎÒÔÚVISTA ÏÂÓÃVMware °²×°ºìÆì6.5ʱ£¬°²×°µ½Ó²ÅÌ·ÖÇøµÄʱºò£¬×ÜÊdzöÏÖÒ»¸ö¶Ô»°¿ò¡£ÉÏÃæд×Å£º¡°³öÏÖ´íÎó---δÕÒµ½ÒªÔÚÆäÖд´½¨ÐÂÎļþϵͳµÄÓÐЧÉ豸¡£Çë¼ì²éÄãµÄÓ²¼þÒÔÕÒµ½ÎÊÌâµÄÆðÒò¡£¡±ÇëÎÊÔõô½ ......
192.168.0.201ÊÇLinux
192.168.0.35ÊÇÁíÍâһ̨װÓÐWEBµÄ·þÎñÆ÷£¬
ÎÒÏë·ÃÎÊ192.168.0.201µÄʱºò
ÈÃËûnatµ½192.168.0.35µÄ80ÉÏ¡£
ÒÔÏÂÊÇÎÒÉèÖõģ¬µ«ÊDz»ÐС£Ó¦¸ÃÔõôÉèÖÃѽ£¿
root@ubuntu:/h ......
д³öÍê³ÉÒÔϹ¦ÄܵÄLinuxÃüÁî:
1) ÔÚµ±Ç°Ä¿Â¼¼°Æä×ÓĿ¼ËùÓеÄ.cppÎļþÖвéÕÒ×Ö·û´®"example", ²»Çø·Ö´óСд;
2) ʹÓÃsedÃüÁî, ½«ÎļþxyzÖеĵ¥´ÊAAAÈ«²¿Ì滻ΪBBB;
3) ÓÃÒ»ÌõÃüÁî´´½¨aa bb ccÈ ......
ÎÒÔÚ°²×°redhat9µÄʱºòÓÐЩ·þÎñûѡ£¬±ÈÈçsamba£¬http£¬ntfs£¬telnetÏÖÔÚ²»ÏëÖØװϵͳÁË£¬ÇëÎʸÃÔõô×ö£¿
ÎÒÔÚÌí¼Ó/ɾ³ýÓ¦ÓóÌÐòÖÐ×°ÁËsamba£¬µ«ÊÇÖØÆôÖ®ºó£¬ÔÚ¡°ÏµÍ³ÉèÖÃ-·þÎñÆ÷ÉèÖá±ÖÐÔõô»¹Ã»³öÏÖsamba·þÎñÆ÷ ......
chmodÖеÄmode_t²ÎÊý£¬ÈçºÎ¶¯Ì¬µÄ´«ÈëÖµ£¬ÀýÈç ÎÒÒª´«Èë0777»ò0444£¬µ«ÎÒÊäÈëµÄÊÇ×Ö·û´® Ôõôת»¯Îª8½øÖÆ
ÿ¸öģʽ¾ùÔ¤¶¨ÒåÓк꣬ÓÖÒòΪÆäʵ¿ÉÑ¡·ÖÖ§ÓÐÏÞ£¬Äã¿ÉÒÔÅжÏÊäÈëµÃ×Ö·û´®£¬Ê¹ÓÃswicthÖ®ÀàµÃ°ì·¨£¬¸øÒ»ÁÙʱ ......