Source Code C++ Baca File


Di bawah ini adalah source code untuk membaca isi file di pascal.

{—copy here—}

program baca_fle_text;
uses wincrt;
var
f:text;
nama_file:string;
s:string;
begin
clrscr;
write(‘Nama file yang dibaca: ‘);
readln(nama_file);{memanggil nama file “C:\coba.txt”}
assign(f,nama_file);{memanggil file}
reset(f);{membuka file}
while not eof(f) do {menampilkan seluruh isi file}
begin
readln(f,s);
writeln(s);
end;
close(f);{menutup file}
end.

—Selemat Mencoba—

Iklan

Satu pemikiran pada “Source Code C++ Baca File

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s