³ÌÐòÉè¼ÆµäÐÍÀýÌâ½âÎö(2)
µäÐÍÀýÌâ½âÎö£¨2£©
Ò»¡¢Ìî¿ÕÌâ
1£®ÒÔ˳ÐòÊäÈëģʽ´ò¿ª¡°c:\\source1.txt¡±ÎļþµÄÃüÁîÊÇ £¨1£© £»ÒÔÊä³ö·½Ê½´ò¿ª¡°c:\\source2.txt¡±ÎļþµÄÃüÁîÊÇ £¨2£© ¡£
·ÖÎö£ºPrint # Óï¾äÓÃÓÚ½«°ÑÊý¾ÝдÈëÎļþÖС£PrintÓï¾ä¸ñʽΪ£º
Open ÎļþÃû [Forģʽ] As [#] ÎļþºÅ ¡°For ģʽ¡±ÎªÖ¸¶¨´ò¿ªÎļþµÄģʽÊÇÊý¾ÝµÄÊäÈëģʽ»¹ÊÇÊä³öģʽ¡£
½áÂÛ£º´ð°¸Ó¦Îª£º£¨1£©Open \For Input As #1
£¨2£©Open \
For Output As #2
2.ÔÚVisual BasicÖУ¬Îļþϵͳ¿Ø¼þ°üÀ¨ £¨1£© ¡¢ £¨2£© ºÍÎļþÁбí¿ò£¨FileListBox£©¡£ÈýÕßÐͬ²Ù×÷¿ÉÒÔ·ÃÎÊÈÎÒâλÖõÄĿ¼ºÍÎļþ£¬¿ÉÒÔ½øÐÐÎļþϵͳµÄÈË»ú½»»¥¹ÜÀí¡£
·ÖÎö£ºÔÚVisual BasicÖУ¬Îļþϵͳ¿Ø¼þ°üÀ¨Çý¶¯Æ÷Áбí¿ò£¨DriveListBox£©¡¢Ä¿Â¼Áбí
¿ò£¨DirListBox£©ºÍÎļþÁбí¿ò£¨FileListBox£©¡£Çý¶¯Æ÷Áбí¿ò¿ÉÒÔÑ¡Ôñ»òÉèÖÃÒ»¸öÇý¶¯Æ÷£¬Ä¿Â¼Áбí¿ò¿ÉÒÔ²éÕÒ»òÉèÖÃÖ¸¶¨Çý¶¯Æ÷ÖеÄĿ¼£¬ÎļþÁбí¿ò¿ÉÒÔ²éÕÒÖ¸¶¨Çý¶¯Æ÷Ö¸¶¨Ä¿Â¼ÖÐÎļþÐÅÏ¢£¬ÈýÕßÐͬ²Ù×÷¿ÉÒÔ·ÃÎÊÈÎÒâλÖõÄĿ¼ºÍÎļþ£¬¿ÉÒÔ½øÐÐÎļþϵͳµÄÈË»ú½»»¥¹ÜÀí¡£
½áÂÛ£º´ð°¸Ó¦Îª£º£¨1£©Çý¶¯Æ÷Áбí¿ò£¨DriveListBox£©£¨2£©Ä¿Â¼Áбí¿ò£¨DirListBox£©
3£®Ã¿´ÎÖØÐÂÉèÖÃÇý¶¯Æ÷Áбí¿òµÄDriveÊôÐÔʱ£¬¶¼½«Òý·¢ £¨1£© ʼþ¡£¿ÉÔÚ¸Ãʼþ¹ý³ÌÖбàд´úÂëÐÞ¸ÄĿ¼Áбí¿òµÄ·¾¶£¬Ê¹Ä¿Â¼Áбí¿òÄÚÈÝËæÖ®·¢Éú¸Ä±ä¡£
·ÖÎö£ºÔÚVisual BasicÖУ¬Ã¿´ÎÖØÐÂÉèÖÃÇý¶¯Æ÷Áбí¿òµÄDriveÊôÐÔʱ£¬¶¼½«Òý·¢Changeʼþ¡£¿ÉÔÚChangeʼþ¹ý³ÌÖбàд´úÂëÐÞ¸ÄĿ¼Áбí¿òµÄ·¾¶£¬Ê¹Ä¿Â¼Áбí¿òÄÚÈÝËæÖ®·¢Éú¸Ä±ä¡£Çý¶¯Æ÷Áбí¿òµÄĬÈÏÃû³ÆΪDrive1£¬ÆäChangeʼþ¹ý³ÌµÄ¿ªÍ·ÎªDrive1_Change()¡£
½áÂÛ£º´ð°¸Ó¦Îª£º£¨1£©Change
4£®Ä¿Â¼Áбí¿òÓÃÀ´ÏÔʾµ±Ç°Çý¶¯Æ÷ÏÂĿ¼
½á¹¹¡£¸Õ½¨Á¢Ê±ÏÔʾ £¨1£© µÄ¶¥²ãĿ¼ºÍµ±Ç°Ä¿Â¼£¬Èç¹ûÒªÏÔʾÆäËûÇý¶¯Æ÷ÉϵÄĿ¼ÐÅÏ¢£¬±ØÐë¸Ä±ä·¾¶£¬¼´ÖØÐÂÉèÖÃĿ¼Áбí¿òµÄ £¨2£© ÊôÐÔ¡£
·ÖÎö£ºÔÚVisual BasicÖУ¬Ä¿Â¼Áбí¿òÓÃÀ´ÏÔʾµ±Ç°Çý¶¯Æ÷ÏÂĿ¼½á¹¹¡£¸Õ½¨Á¢Ê±ÏÔʾµ±Ç°Çý¶¯Æ÷µÄ¶¥²ãĿ¼ºÍµ±Ç°Ä¿Â¼£¬Èç¹ûÒªÏÔʾÆäËûÇý¶¯Æ÷ÉϵÄĿ¼£¬±ØÐë¸Ä±ä·¾¶£¬¼´ÖØÐÂÉèÖÃĿ¼Áбí¿òµÄPathÊôÐÔ¡£
½áÂÛ£º´ð°¸Ó¦Îª£º£¨1£©µ±Ç°Çý¶¯Æ÷£¨2£©Path
5£®¶ÔÇý¶¯Æ÷Áбí¿òÀ´Ëµ£¬Ã¿´ÎÖØÐÂÉèÖÃÇý¶¯Æ÷Áбí¿òµÄ £¨1£© ÊôÐÔʱ£¬½«Òý·¢Changeʼþ£»¶ÔĿ¼Áбí¿òÀ´Ëµ£¬µ± £¨2£© ÊôÐÔÖµ¸Ä±äʱ£¬½«Òý·¢Changeʼþ£»¶ÔÓÚÎļþÁбí¿ò£¬ÖØÐÂÉèÖÃµÄ £¨3£© ÊôÐÔ£¬½«Òý·¢Changeʼþ¡£
·ÖÎö£ºÔÚVisual BasicÖУ¬¶ÔÇý¶¯Æ÷Áбí¿òÀ´Ëµ£¬Ã¿´ÎÖØÐÂÉèÖÃÇý¶¯Æ÷Áбí¿òµÄDriveÊôÐÔʱ£¬½«Òý·¢Changeʼþ£»¶ÔÓÚĿ¼Áбí¿òºÍÎļþÁбí¿ò¸Ä±ä·¾¶£¬¼´ÖØÐÂÉèÖÃÁбí¿òµÄPathÊôÐÔ£¬½«Òý·¢Changeʼþ¡£