-
10-14-2013, 07:00 AM #11Junior Member
- Ngày tham gia
- Apr 2015
- Bài viết
- 0
ok đã tham khảo 1 số ý kiến chuyên gia và có 1 số nhận xét như sau:
return trong catch tránh được mấy lỗi ở phía sau:
vd:nullpointerexception ở hai câu lệnh close cho cái fin va fout ay
cai return trong catch
fin = new fileinputstream("e:\\in.mp3");
fout = new fileoutputstream("e:\\out.mp3");
nếu exception xảy ra mà ko có return thì code sẽ gặp giá trị num values ở fin.close(); fout.close() phía dưới.
-
10-17-2013, 07:00 AM #12Junior Member
- Ngày tham gia
- Jul 2015
- Bài viết
- 0
làm sao gửi lên giữ nguyên màu sắc của code vậy mọi người?
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:/* * to change this template, choose tools | templates * and open the template in the editor. */ package javaapplication1; import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.scanner; /** * * @author misskieu */ public class copytuconsole { private string inputpath; private string outputpath; private string request; scanner inp = new scanner(system.in); public void copyfile(string inputpath, string outputpath) throws ioexception{ fileinputstream finp; fileoutputstream fout; try { finp = new fileinputstream(inputpath); } catch (filenotfoundexception e) { system.out.println("input file not found"); return; } try { fout = new fileoutputstream(outputpath); } catch (filenotfoundexception e) { system.out.println("error opening outputfile"); return; } int i; do { i = finp.read(); if (i != -1) { fout.write(i); } } while (i != -1); finp.close(); fout.close(); system.out.println("finish copy file"); } public void deletefile(string path){ try { file file = new file(path); if (file.delete()) { system.out.println(file.getname() + " is deleted!"); } else { system.out.println("delete operation is failed."); } } catch (exception e) { e.printstacktrace(); } } public void movefile(string inputpath,string outputpath) throws ioexception{ copyfile(inputpath, outputpath); deletefile(inputpath); system.out.println("finished move file"); } void xulyrequest() throws ioexception{ system.out.println("nhap yeu cau:copy, delete, move, exit?"); request = inp.nextline(); switch(request){ case "copy": system.out.println("nhap duong dan file copy: " ); inputpath = inp.nextline(); system.out.println("nhap duong dan dich den: " ); outputpath = inp.nextline(); copyfile(inputpath, outputpath); xulyrequest(); break; case "delete": system.out.println("nhap duong dan file delete: " ); inputpath = inp.nextline(); deletefile(inputpath); xulyrequest(); case "move": system.out.println("nhap duong dan file copy: " ); inputpath = inp.nextline(); system.out.println("nhap duong dan dich den: " ); outputpath = inp.nextline(); copyfile(inputpath, outputpath); deletefile(inputpath); xulyrequest(); case "exit": system.out.println("ban da thoat khoi chuong trinh"); break; default: xulyrequest(); } } public static void main(string[] args) throws ioexception { copytuconsole a = new copytuconsole(); a.xulyrequest(); } }
</div>
</div>
-
11-11-2013, 07:00 AM #13Junior Member
- Ngày tham gia
- Jul 2015
- Bài viết
- 2
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
[/color][color=#ff8000]/** to change this license header, choose license headers in project properties.* to change this template file, choose tools | templates* and open the template in the editor.*/[/color][color=#0000bb]package javabasic[/color][color=#007700].[/color][color=#0000bb]demo[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]nio[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700].[/color][color=#0000bb]files[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; [/color][color=#ff8000]/**** @author systemadmin*/[/color][color=#007700]public class [/color][color=#0000bb]baitap [/color][color=#007700]{ [/color][color=#0000bb]fileinputstream fin[/color][color=#007700]; [/color][color=#0000bb]fileoutputstream fout[/color][color=#007700]; public [/color][color=#0000bb]void copy[/color][color=#007700]([/color][color=#0000bb]string str1[/color][color=#007700], [/color][color=#0000bb]string str2[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ try { try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]str1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]); return; } try { [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]str2[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error opening output file"[/color][color=#007700]); return; } } catch ([/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"usage: copyfile from to"[/color][color=#007700]); return; } [/color][color=#0000bb]int i[/color][color=#007700]; try { do { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } } while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); } catch ([/color][color=#0000bb]ioexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file error"[/color][color=#007700]); } [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } public [/color][color=#0000bb]void move[/color][color=#007700]([/color][color=#0000bb]string str1[/color][color=#007700], [/color][color=#0000bb]string str2[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ try { try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]str1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]); return; } try { [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]str2[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"error opening output file"[/color][color=#007700]); return; } } catch ([/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"usage: movefile from to"[/color][color=#007700]); } [/color][color=#0000bb]int i[/color][color=#007700]; try { do { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } } while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); } catch ([/color][color=#0000bb]ioexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file error"[/color][color=#007700]); } [/color][color=#0000bb]file f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]str1[/color][color=#007700]); [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } public [/color][color=#0000bb]void delete[/color][color=#007700]([/color][color=#0000bb]string str1[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]str1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]); } [/color][color=#0000bb]file f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]str1[/color][color=#007700]); [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]string cmd[/color][color=#007700]; [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]cmd [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]baitap a [/color][color=#007700]= new [/color][color=#0000bb]baitap[/color][color=#007700](); [/color][color=#0000bb]string cmdarr[/color][color=#007700][] = [/color][color=#0000bb]cmd[/color][color=#007700].[/color][color=#0000bb]split[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); switch ([/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]0[/color][color=#007700]]) { case [/color][color=#dd0000]"copy"[/color][color=#007700]: [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]copy[/color][color=#007700]([/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]1[/color][color=#007700]], [/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]2[/color][color=#007700]]); break; case [/color][color=#dd0000]"move"[/color][color=#007700]: [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]move[/color][color=#007700]([/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]1[/color][color=#007700]], [/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]2[/color][color=#007700]]); break; case [/color][color=#dd0000]"del"[/color][color=#007700]: [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700]([/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]1[/color][color=#007700]]); break; default: [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"\""[/color][color=#007700]+[/color][color=#0000bb]cmdarr[/color][color=#007700][[/color][color=#0000bb]0[/color][color=#007700]]+[/color][color=#dd0000]"\""[/color][color=#007700]+[/color][color=#dd0000]" command is not found"[/color][color=#007700]); break; } }}[/color]
</div>
</div>
-
01-29-2014, 07:00 AM #14Junior Member
- Ngày tham gia
- Apr 2015
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
[/color][color=#007700]public static [/color][color=#0000bb]void main [/color][color=#007700]([/color][color=#0000bb]string [/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]string command[/color][color=#007700]; [/color][color=#0000bb]boolean havecommand [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"go lenh ban muon su dung ( copy, move, delete): "[/color][color=#007700]); [/color][color=#0000bb]command [/color][color=#007700]= ([/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]().[/color][color=#0000bb]trim[/color][color=#007700]()); [/color][color=#0000bb]havecommand [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; switch ( [/color][color=#0000bb]command[/color][color=#007700]){ case [/color][color=#dd0000]"copy"[/color][color=#007700]: [/color][color=#0000bb]copy[/color][color=#007700](); break; case [/color][color=#dd0000]"move"[/color][color=#007700]: [/color][color=#0000bb]move[/color][color=#007700](); break; case [/color][color=#dd0000]"delete"[/color][color=#007700]: [/color][color=#0000bb]delete[/color][color=#007700](); break; default: [/color][color=#0000bb]havecommand [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; break; } } while ( ![/color][color=#0000bb]havecommand [/color][color=#007700]); } public static [/color][color=#0000bb]void delete[/color][color=#007700](){ [/color][color=#0000bb]string path[/color][color=#007700]; [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]boolean havefile[/color][color=#007700]; [/color][color=#0000bb]file f[/color][color=#007700]; do { [/color][color=#0000bb]havefile [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"go duong dan file ban muon delete: "[/color][color=#007700]); [/color][color=#0000bb]path [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]path[/color][color=#007700]); if ( ![/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]exists[/color][color=#007700]()) { [/color][color=#0000bb]havefile [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]); } } while (![/color][color=#0000bb]havefile[/color][color=#007700]); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"have finished delete file"[/color][color=#007700]); } public static [/color][color=#0000bb]void move[/color][color=#007700]() [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]boolean haveinput[/color][color=#007700]; [/color][color=#0000bb]fileinputstream fin [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]fileoutputstream fout [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]string path1[/color][color=#007700], [/color][color=#0000bb]path2[/color][color=#007700]; [/color][color=#0000bb]file f[/color][color=#007700]; do { [/color][color=#0000bb]haveinput [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"go duong dan file ban muon move: " [/color][color=#007700]); [/color][color=#0000bb]path1 [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]().[/color][color=#0000bb]trim[/color][color=#007700](); [/color][color=#0000bb]f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]path1[/color][color=#007700]); if ( ![/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]exists[/color][color=#007700]()) { [/color][color=#0000bb]haveinput [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]); } } while (![/color][color=#0000bb]haveinput[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"go duong dan file ban muon move den: "[/color][color=#007700]); [/color][color=#0000bb]path2 [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]().[/color][color=#0000bb]trim[/color][color=#007700](); try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]path1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]logger[/color][color=#007700].[/color][color=#0000bb]getlogger[/color][color=#007700]([/color][color=#0000bb]fileprocess[/color][color=#007700].class.[/color][color=#0000bb]getname[/color][color=#007700]()).[/color][color=#0000bb]log[/color][color=#007700]([/color][color=#0000bb]level[/color][color=#007700].[/color][color=#0000bb]severe[/color][color=#007700], [/color][color=#0000bb]null[/color][color=#007700], [/color][color=#0000bb]ex[/color][color=#007700]); } try { [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]path2[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]logger[/color][color=#007700].[/color][color=#0000bb]getlogger[/color][color=#007700]([/color][color=#0000bb]fileprocess[/color][color=#007700].class.[/color][color=#0000bb]getname[/color][color=#007700]()).[/color][color=#0000bb]log[/color][color=#007700]([/color][color=#0000bb]level[/color][color=#007700].[/color][color=#0000bb]severe[/color][color=#007700], [/color][color=#0000bb]null[/color][color=#007700], [/color][color=#0000bb]ex[/color][color=#007700]); } [/color][color=#0000bb]int i[/color][color=#007700]; do { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if ( [/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]) [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } public static [/color][color=#0000bb]void copy[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]boolean haveinput[/color][color=#007700]; [/color][color=#0000bb]fileinputstream fin [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]fileoutputstream fout [/color][color=#007700]= [/color][color=#0000bb]null[/color][color=#007700]; [/color][color=#0000bb]scanner input [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]string path1[/color][color=#007700], [/color][color=#0000bb]path2[/color][color=#007700]; do { [/color][color=#0000bb]haveinput [/color][color=#007700]= [/color][color=#0000bb]true[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"go duong dan file ban muon copy : "[/color][color=#007700]); [/color][color=#0000bb]path1 [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]().[/color][color=#0000bb]trim[/color][color=#007700](); [/color][color=#0000bb]file f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]path1[/color][color=#007700]); if ( ![/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]exists[/color][color=#007700]()) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]); [/color][color=#0000bb]haveinput [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; } } while (![/color][color=#0000bb]haveinput[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"go duong dan file ban muon tao ra: "[/color][color=#007700]); [/color][color=#0000bb]path2 [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]().[/color][color=#0000bb]trim[/color][color=#007700](); [/color][color=#0000bb]int i[/color][color=#007700]; try { [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]path1[/color][color=#007700]); } catch ([/color][color=#0000bb]filenotfoundexception ex[/color][color=#007700]) { [/color][color=#0000bb]logger[/color][color=#007700].[/color][color=#0000bb]getlogger[/color][color=#007700]([/color][color=#0000bb]fileprocess[/color][color=#007700].class.[/color][color=#0000bb]getname[/color][color=#007700]()).[/color][color=#0000bb]log[/color][color=#007700]([/color][color=#0000bb]level[/color][color=#007700].[/color][color=#0000bb]severe[/color][color=#007700], [/color][color=#0000bb]null[/color][color=#007700], [/color][color=#0000bb]ex[/color][color=#007700]); } [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]path2[/color][color=#007700]); do { [/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if ( [/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]) [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]); [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"finish copy"[/color][color=#007700]); }[/color]
</div>
</div>
-
03-04-2014, 07:00 AM #15Junior Member
- Ngày tham gia
- May 2015
- Bài viết
- 0
bai minh lam:
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package nhansu[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700];public class [/color][color=#0000bb]luongtrongjava [/color][color=#007700]{ [/color][color=#0000bb]scanner input[/color][color=#007700]=new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); public [/color][color=#0000bb]void copy[/color][color=#007700]([/color][color=#0000bb]string st1[/color][color=#007700],[/color][color=#0000bb]string st2[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]fileinputstream f1[/color][color=#007700]; [/color][color=#0000bb]fileoutputstream f2[/color][color=#007700]; [/color][color=#0000bb]int i[/color][color=#007700]; try{ [/color][color=#0000bb]f1[/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]st1[/color][color=#007700]); } catch([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file khong ton tai"[/color][color=#007700]); return; } try{ [/color][color=#0000bb]f2[/color][color=#007700]=new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]st2[/color][color=#007700]); } catch([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"loi 1"[/color][color=#007700]); return; } try{ do{ [/color][color=#0000bb]i[/color][color=#007700]=[/color][color=#0000bb]f1[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); [/color][color=#0000bb]f2[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]); } while([/color][color=#0000bb]i[/color][color=#007700]!=-[/color][color=#0000bb]1[/color][color=#007700]); } catch([/color][color=#0000bb]ioexception exc[/color][color=#007700]){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"loi 2"[/color][color=#007700]); } } public [/color][color=#0000bb]void xulicopy[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"file nguon:"[/color][color=#007700]); [/color][color=#0000bb]string st2[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"file dich:"[/color][color=#007700]); [/color][color=#0000bb]string st3[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]copy[/color][color=#007700]([/color][color=#0000bb]st2[/color][color=#007700],[/color][color=#0000bb]st3[/color][color=#007700]); } public [/color][color=#0000bb]void xulimove[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"thu muc chua file can move:"[/color][color=#007700]); [/color][color=#0000bb]string st1[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"ten file:"[/color][color=#007700]); [/color][color=#0000bb]string st2[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"ban muon chuyen file do den thu muc nao:"[/color][color=#007700]); [/color][color=#0000bb]string st3[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]file f[/color][color=#007700]=new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]st3[/color][color=#007700]+[/color][color=#dd0000]"\\"[/color][color=#007700]+[/color][color=#0000bb]st2[/color][color=#007700]); [/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]createnewfile[/color][color=#007700](); [/color][color=#0000bb]copy[/color][color=#007700]([/color][color=#0000bb]st1[/color][color=#007700]+[/color][color=#dd0000]"\\"[/color][color=#007700]+[/color][color=#0000bb]st2[/color][color=#007700],[/color][color=#0000bb]st3[/color][color=#007700]+[/color][color=#dd0000]"\\"[/color][color=#007700]+[/color][color=#0000bb]st2[/color][color=#007700]); [/color][color=#0000bb]file f2[/color][color=#007700]=new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]st1[/color][color=#007700]+[/color][color=#dd0000]"\\"[/color][color=#007700]+[/color][color=#0000bb]st2[/color][color=#007700]); [/color][color=#0000bb]f2[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][][/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]luongtrongjava a[/color][color=#007700]=new [/color][color=#0000bb]luongtrongjava[/color][color=#007700](); [/color][color=#0000bb]scanner input[/color][color=#007700]=new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ban muon lam gi?(copy hay move)"[/color][color=#007700]); [/color][color=#0000bb]string st[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); if([/color][color=#0000bb]st[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"copy"[/color][color=#007700])) [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]xulicopy[/color][color=#007700](); if([/color][color=#0000bb]st[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"move"[/color][color=#007700])) [/color][color=#0000bb]a[/color][color=#007700].[/color][color=#0000bb]xulimove[/color][color=#007700](); }}[/color]
</div>
</div>
-
03-13-2014, 07:00 AM #16Junior Member
- Ngày tham gia
- Apr 2015
- Bài viết
- 0
bài của mình các bạn xem có góp ý gì thêm nhé. sử dụng command line như:
cp \\path1 \\path2
mv \\path1 \\path2
dl \\path1
tự tạo file để copy va mv khi không tìm thấy đường dẫn của path2
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package controlfile[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700]; public class [/color][color=#0000bb]filecontrol [/color][color=#007700]{ private [/color][color=#0000bb]byte [/color][color=#007700][] [/color][color=#0000bb]commandinput [/color][color=#007700]= new [/color][color=#0000bb]byte[/color][color=#007700][[/color][color=#0000bb]100[/color][color=#007700]]; private [/color][color=#0000bb]char [/color][color=#007700][] [/color][color=#0000bb]arrchar [/color][color=#007700]= new [/color][color=#0000bb]char[/color][color=#007700][[/color][color=#0000bb]100[/color][color=#007700]]; private [/color][color=#0000bb]string path1[/color][color=#007700]; private [/color][color=#0000bb]string path2[/color][color=#007700]; private [/color][color=#0000bb]string commandline[/color][color=#007700]; public [/color][color=#0000bb]filecontrol[/color][color=#007700]() { } [/color][color=#ff8000]/* method of filecontrol class*/ [/color][color=#007700]public [/color][color=#0000bb]void getcommand[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"put command: "[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700]([/color][color=#0000bb]commandinput[/color][color=#007700]); [/color][color=#ff8000]// change command form byte to char [/color][color=#007700]for ( [/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]commandinput[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++ ) { [/color][color=#0000bb]arrchar[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = ([/color][color=#0000bb]char[/color][color=#007700]) [/color][color=#0000bb]commandinput[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#ff8000]//debug read console //system.out.print( "" + arrchar[i] ); [/color][color=#007700]} [/color][color=#ff8000]// convert char to string [/color][color=#0000bb]commandline [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#0000bb]arrchar[/color][color=#007700], [/color][color=#0000bb]0 [/color][color=#007700], [/color][color=#0000bb]arrchar[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]); [/color][color=#0000bb]commandline [/color][color=#007700]= [/color][color=#0000bb]commandline [/color][color=#007700]+ [/color][color=#dd0000]" "[/color][color=#007700]; [/color][color=#0000bb]arrchar [/color][color=#007700]= [/color][color=#0000bb]commandline[/color][color=#007700].[/color][color=#0000bb]tochararray[/color][color=#007700](); } [/color][color=#ff8000]// copy file [/color][color=#007700]@[/color][color=#0000bb]suppresswarnings[/color][color=#007700]([/color][color=#dd0000]"resource"[/color][color=#007700]) public [/color][color=#0000bb]void copyfile[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]int i[/color][color=#007700]=[/color][color=#0000bb]3[/color][color=#007700]; while ( [/color][color=#0000bb]arrchar[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] != [/color][color=#dd0000]' '[/color][color=#007700]) { [/color][color=#0000bb]i[/color][color=#007700]++; } [/color][color=#0000bb]path1 [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#0000bb]arrchar[/color][color=#007700], [/color][color=#0000bb]3[/color][color=#007700], [/color][color=#0000bb]i[/color][color=#007700]-[/color][color=#0000bb]3[/color][color=#007700]); [/color][color=#0000bb]path1 [/color][color=#007700]= [/color][color=#0000bb]path1[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700](); [/color][color=#0000bb]path2 [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#0000bb]arrchar[/color][color=#007700], [/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700], [/color][color=#0000bb]arrchar[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]-[/color][color=#0000bb]i[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700]); [/color][color=#0000bb]path2 [/color][color=#007700]= [/color][color=#0000bb]path2[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700](); [/color][color=#ff8000]//system.out.println("debug: " + path1); //system.out.println("debug: " + path2 + " " + command.length); [/color][color=#0000bb]fileinputstream fin [/color][color=#007700]; [/color][color=#0000bb]fileoutputstream fout[/color][color=#007700]; [/color][color=#ff8000]// access to file input [/color][color=#007700]try { try { [/color][color=#ff8000]//fin = new fileinputstream("f:\\tungn1.txt"); [/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]path1[/color][color=#007700]); } catch ( [/color][color=#0000bb]filenotfoundexception exc [/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found in path " [/color][color=#007700]+ [/color][color=#0000bb]path1[/color][color=#007700]); return; } [/color][color=#ff8000]// access to file output [/color][color=#007700]try { [/color][color=#ff8000]//fout = new fileoutputstream("e:\\copy.txt"); [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]path2[/color][color=#007700]); } catch ( [/color][color=#0000bb]filenotfoundexception exc [/color][color=#007700]) { [/color][color=#ff8000]//system.out.println("file not found in path " + path2); [/color][color=#0000bb]file fcopy [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]path2[/color][color=#007700]); [/color][color=#0000bb]fcopy[/color][color=#007700].[/color][color=#0000bb]createnewfile[/color][color=#007700](); [/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]path2[/color][color=#007700]); return; } } catch ( [/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"" [/color][color=#007700]+ [/color][color=#0000bb]exc[/color][color=#007700]); return; } [/color][color=#ff8000]// copy file [/color][color=#0000bb]int j[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700]; do { [/color][color=#0000bb]j [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700](); if ( [/color][color=#0000bb]j [/color][color=#007700]!= -[/color][color=#0000bb]1 [/color][color=#007700]) { [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]j[/color][color=#007700]); } } while ( [/color][color=#0000bb]j [/color][color=#007700]!= -[/color][color=#0000bb]1 [/color][color=#007700]); [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"finish"[/color][color=#007700]); } [/color][color=#ff8000]// move file [/color][color=#007700]public [/color][color=#0000bb]void movefile[/color][color=#007700]() [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]copyfile[/color][color=#007700](); [/color][color=#0000bb]file fdel[/color][color=#007700]; [/color][color=#0000bb]fdel [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]path1[/color][color=#007700]); [/color][color=#0000bb]fdel[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); } [/color][color=#ff8000]// delete file [/color][color=#007700]public [/color][color=#0000bb]void deletefile[/color][color=#007700]() [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]file fdel[/color][color=#007700]; [/color][color=#0000bb]byte[/color][color=#007700][] [/color][color=#0000bb]confirm [/color][color=#007700]= new [/color][color=#0000bb]byte[/color][color=#007700][[/color][color=#0000bb]100[/color][color=#007700]]; [/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]3[/color][color=#007700]; while ( [/color][color=#0000bb]arrchar[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] != [/color][color=#dd0000]' ' [/color][color=#007700]) { [/color][color=#0000bb]i[/color][color=#007700]++; } [/color][color=#0000bb]string path [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#0000bb]arrchar[/color][color=#007700], [/color][color=#0000bb]3[/color][color=#007700], [/color][color=#0000bb]i[/color][color=#007700]-[/color][color=#0000bb]3[/color][color=#007700]); [/color][color=#0000bb]path [/color][color=#007700]= [/color][color=#0000bb]path[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700](); [/color][color=#0000bb]fdel [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]path[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"do you want to delete file " [/color][color=#007700]+ [/color][color=#0000bb]path [/color][color=#007700]+ [/color][color=#dd0000]" ?" [/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700]([/color][color=#0000bb]confirm[/color][color=#007700]); if (([/color][color=#0000bb]char[/color][color=#007700]) [/color][color=#0000bb]confirm[/color][color=#007700][[/color][color=#0000bb]0[/color][color=#007700]] == [/color][color=#dd0000]'y' [/color][color=#007700]|| ([/color][color=#0000bb]char[/color][color=#007700]) [/color][color=#0000bb]confirm[/color][color=#007700][[/color][color=#0000bb]0[/color][color=#007700]] == [/color][color=#dd0000]'y'[/color][color=#007700]) { [/color][color=#0000bb]fdel[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"delete complete"[/color][color=#007700]); } else { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"cancel delete file " [/color][color=#007700]+ [/color][color=#0000bb]path[/color][color=#007700]); } } [/color][color=#ff8000]// choose command [/color][color=#007700]public [/color][color=#0000bb]void choosecommand[/color][color=#007700]() [/color][color=#0000bb]throws ioexception[/color][color=#007700]{ [/color][color=#0000bb]getcommand[/color][color=#007700](); [/color][color=#0000bb]string commandline [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700]([/color][color=#0000bb]arrchar[/color][color=#007700], [/color][color=#0000bb]0[/color][color=#007700], [/color][color=#0000bb]2[/color][color=#007700]); if ([/color][color=#0000bb]commandline[/color][color=#007700].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#dd0000]"cp"[/color][color=#007700])) { [/color][color=#0000bb]copyfile[/color][color=#007700](); } else { if ([/color][color=#0000bb]commandline[/color][color=#007700].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#dd0000]"mv"[/color][color=#007700])) { [/color][color=#0000bb]movefile[/color][color=#007700](); } else { if ([/color][color=#0000bb]commandline[/color][color=#007700].[/color][color=#0000bb]equalsignorecase[/color][color=#007700]([/color][color=#dd0000]"dl"[/color][color=#007700])) { [/color][color=#0000bb]deletefile[/color][color=#007700](); } else { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"can not excute this command " [/color][color=#007700]+ [/color][color=#0000bb]commandline[/color][color=#007700]); } } } }} [/color][color=#ff8000]// main class[/color][color=#0000bb]package controlfile[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700]; public class [/color][color=#0000bb]main [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{ [/color][color=#0000bb]filecontrol file1 [/color][color=#007700]= new [/color][color=#0000bb]filecontrol[/color][color=#007700](); [/color][color=#0000bb]file1[/color][color=#007700].[/color][color=#0000bb]choosecommand[/color][color=#007700](); }} [/color]
</div>
</div>
-
03-26-2014, 07:00 AM #17Junior Member
- Ngày tham gia
- Apr 2016
- Bài viết
- 0
cho mình hỏi chút, tại sao trong đoạn này biến i có kiểu int mà vẫn convert đc sang dạng char (a,b,c,...) thế??
Mã:int i; do { i = f.read(); if (i != -1) { system.out.print((char) i); } } while (i != -1);
-
05-11-2014, 07:00 AM #18Junior Member
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
Gửi bởi sasaki
mình đã bỏ (char) và kết quả ra toàn là số thôi
-
06-14-2014, 07:00 AM #19Junior Member
- Ngày tham gia
- Feb 2015
- Bài viết
- 0
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>my exercise (move your mouse to reveal the content)</noscript>
my exercise (open)
my exercise (close)
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package hoc[/color][color=#007700].[/color][color=#0000bb]java[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]file[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]unit27 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{[/color][color=#0000bb]int chucnang[/color][color=#007700];[/color][color=#0000bb]scanner in [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"moi ban chon chuc nang:"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"1: copy"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"2: move"[/color][color=#007700]);[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"3: delete"[/color][color=#007700]);[/color][color=#0000bb]chucnang [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();try {[/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();switch ([/color][color=#0000bb]chucnang[/color][color=#007700]) {case ([/color][color=#0000bb]1[/color][color=#007700]): {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap source file:"[/color][color=#007700]);[/color][color=#0000bb]string src [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap dest file:"[/color][color=#007700]);[/color][color=#0000bb]string dest [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]copy[/color][color=#007700]([/color][color=#0000bb]src[/color][color=#007700], [/color][color=#0000bb]dest[/color][color=#007700]);}case ([/color][color=#0000bb]2[/color][color=#007700]): {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap source file:"[/color][color=#007700]);[/color][color=#0000bb]string src [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap dest file:"[/color][color=#007700]);[/color][color=#0000bb]string dest [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]copy[/color][color=#007700]([/color][color=#0000bb]src[/color][color=#007700], [/color][color=#0000bb]dest[/color][color=#007700]);[/color][color=#0000bb]delete[/color][color=#007700]([/color][color=#0000bb]src[/color][color=#007700]);}case ([/color][color=#0000bb]3[/color][color=#007700]): {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"moi ban nhap file can xoa"[/color][color=#007700]);[/color][color=#0000bb]string file [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#0000bb]delete[/color][color=#007700]([/color][color=#0000bb]file[/color][color=#007700]); }default:return;}} catch ([/color][color=#0000bb]ioexception exc[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"co loi xay ra"[/color][color=#007700]);return;} } public static [/color][color=#0000bb]void delete[/color][color=#007700]([/color][color=#0000bb]string filename[/color][color=#007700]) {[/color][color=#0000bb]file f [/color][color=#007700]= new [/color][color=#0000bb]file[/color][color=#007700]([/color][color=#0000bb]filename[/color][color=#007700]);[/color][color=#0000bb]f[/color][color=#007700].[/color][color=#0000bb]delete[/color][color=#007700]();} public static [/color][color=#0000bb]void copy[/color][color=#007700]([/color][color=#0000bb]string str1[/color][color=#007700], [/color][color=#0000bb]string str2[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{[/color][color=#0000bb]fileinputstream fin[/color][color=#007700];[/color][color=#0000bb]fileoutputstream fout[/color][color=#007700];try {try {[/color][color=#0000bb]fin [/color][color=#007700]= new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]str1[/color][color=#007700]);} catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file not found"[/color][color=#007700]);return;}try {[/color][color=#0000bb]fout [/color][color=#007700]= new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]str2[/color][color=#007700]);} catch ([/color][color=#0000bb]filenotfoundexception exc[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"err open file"[/color][color=#007700]);return;}} catch ([/color][color=#0000bb]arrayindexoutofbound***ception exc[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"usage: copyfile from to"[/color][color=#007700]);return;} [/color][color=#ff8000]// copy[/color][color=#0000bb]int i[/color][color=#007700];try {do {[/color][color=#0000bb]i [/color][color=#007700]= [/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700]();if ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]) {[/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]);}} while ([/color][color=#0000bb]i [/color][color=#007700]!= -[/color][color=#0000bb]1[/color][color=#007700]);} catch ([/color][color=#0000bb]ioexception exc[/color][color=#007700]) {[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"copy file err"[/color][color=#007700]);}[/color][color=#0000bb]fin[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700]();[/color][color=#0000bb]fout[/color][color=#007700].[/color][color=#0000bb]close[/color][color=#007700](); } }[/color]
</div>
</div>
-
06-25-2014, 07:00 AM #20Junior Member
- Ngày tham gia
- Nov 2014
- Đang ở
- Hồ Chí Minh
- Bài viết
- 1
của mình.
Mã nguồn PHP:[color=#000000]
package streamfile[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileinputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]filenotfoundexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]fileoutputstream[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]io[/color][color=#007700].[/color][color=#0000bb]ioexception[/color][color=#007700];[/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]copyapp [/color][color=#007700]{public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) [/color][color=#0000bb]throws ioexception [/color][color=#007700]{[/color][color=#0000bb]scanner inp[/color][color=#007700]=new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]);[/color][color=#0000bb]string str[/color][color=#007700],[/color][color=#0000bb]addin[/color][color=#007700],[/color][color=#0000bb]addout[/color][color=#007700];[/color][color=#0000bb]int k[/color][color=#007700]=[/color][color=#0000bb]1[/color][color=#007700];[/color][color=#ff8000]//gan vao lenh do_while[/color][color=#0000bb]fileinputstream fi[/color][color=#007700];[/color][color=#0000bb]fileoutputstream fo[/color][color=#007700];[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"write 'copy' if you want to copy... "[/color][color=#007700]);[/color][color=#0000bb]str[/color][color=#007700]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();if([/color][color=#0000bb]str[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"copy"[/color][color=#007700])||[/color][color=#0000bb]str[/color][color=#007700].[/color][color=#0000bb]trim[/color][color=#007700]().[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#dd0000]"copy"[/color][color=#007700])){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"let put the address: "[/color][color=#007700]);[/color][color=#0000bb]addin[/color][color=#007700]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();[/color][color=#ff8000]//buoc 2 nhap ten file vao kiem tra xem file co ton tai hay ko. [/color][color=#007700]do{try{[/color][color=#0000bb]fi[/color][color=#007700]=new [/color][color=#0000bb]fileinputstream[/color][color=#007700]([/color][color=#0000bb]addin[/color][color=#007700]);[/color][color=#0000bb]k[/color][color=#007700]=[/color][color=#0000bb]2[/color][color=#007700];}catch([/color][color=#0000bb]filenotfoundexception e[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file is not available! please try again:... "[/color][color=#007700]);return;}}while([/color][color=#0000bb]k[/color][color=#007700]==[/color][color=#0000bb]1[/color][color=#007700]);[/color][color=#ff8000]//hoi file dich[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"where do you want to copy?... "[/color][color=#007700]);[/color][color=#0000bb]addout[/color][color=#007700]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700]();do{try{[/color][color=#0000bb]fo[/color][color=#007700]=new [/color][color=#0000bb]fileoutputstream[/color][color=#007700]([/color][color=#0000bb]addout[/color][color=#007700]);[/color][color=#0000bb]k[/color][color=#007700]=[/color][color=#0000bb]1[/color][color=#007700];}catch([/color][color=#0000bb]filenotfoundexception e[/color][color=#007700]){[/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"file is not available! please try again:... "[/color][color=#007700]);return;}}while([/color][color=#0000bb]k[/color][color=#007700]==[/color][color=#0000bb]2[/color][color=#007700]);[/color][color=#ff8000]//copy[/color][color=#0000bb]int i[/color][color=#007700];do{[/color][color=#0000bb]i[/color][color=#007700]=[/color][color=#0000bb]fi[/color][color=#007700].[/color][color=#0000bb]read[/color][color=#007700]();if([/color][color=#0000bb]i[/color][color=#007700]!=-[/color][color=#0000bb]1[/color][color=#007700])[/color][color=#0000bb]fo[/color][color=#007700].[/color][color=#0000bb]write[/color][color=#007700]([/color][color=#0000bb]i[/color][color=#007700]);}while([/color][color=#0000bb]i[/color][color=#007700]!=-[/color][color=#0000bb]1[/color][color=#007700]); }}}[/color]
Một trong những điểm mạnh của Công ty TNHH SX TM Thép Đông Anh chính là sự linh hoạt trong việc đáp ứng nhu cầu đa dạng của khách hàng. Chúng tôi hiểu rằng mỗi công trình xây dựng đều có những yêu...
Lưới thép hàn Đông Anh - Được các nhà thầu tin cậy và lựa chọn