🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #24130

Re: ������������̣���������������

#24130
From: Lin
Date: Wed, 29 Apr 1998 00:00
50 lines
2785 bytes

: public class test extends Applet
: {
:     StringBuffer buffer=new StringBuffer();
:     int i
:     public void init()
:     {
:         addone();
:     }
:     void addone()
:     {
:         FileInputStream fi=null;
:         DataInputStream fin=null;
:         FileOutputStream fou=null;
:         DataOutputStream fout=null;

��������ʹ��DataInput/OutputStream, ����ζ����ֻ���Զ�������ʽ
��ȡ��ݡ��Ҳ²���������Edit��Notepad�༭�ˡ�data"�ļ�����
�ַ�ʽ��������0�������ļ���ʵ��ֻ�������ֽڣ���readInt()Ҫ��
�ĸ��ֽڣ������Ȼ�����������κ�����򶼴�0��ʼ�����ҽ���ɸ�
��PrintStream��DataInputStream:
1. д���i���ļ�"data":

PrintStream ps = new PrintStream(new FileOutputStream(new File("data")));
ps.println(i);
ps.close();

ע���������Ҫ����catch�������������һ��


2. ��"data"������
DataInputStream dis = new DataInputStream(new FileInputStream(new File("data")));
i = Integer.parseInt(dis.readLine());
dis.close();

�������������AppletӦ�������С���ֻ���ڱ����Netscape��Explorer�����С�
Ҳ����˵��ֻ�����Netscape������̨�����ϵļ�����HTML����HTML���ܱ��������
�ϵ�����������Applet���ܷ�����������ϵ��ļ���
����ͬѧ��֪�����ʵ��WWW�ϵ��Լ��ļ�������ͻ���ַ��ʾ����������й�CGI��
֪ʶ��


: �ó���ʹ��֮ǰ�Ƚ���һ��data�ļ����ɡ�����ҵ��Ҫɶ������0.
: �������������Ҳ���ܣ��������0��ʼ����
: �����м��κ��Ҵ򿪸��ļ���������ʾ�İ���������


--
�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: 202.119.36.70]
Technical Details
Message-ID: <3OIEKQ$8Kf@bbs.nju.edu.cn>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f6cb0,4e2328a8a1f95bd5
X-Google-Attributes: gidf6cb0,public
From: Woods.bbs@bbs.nju.edu.cn (Lin)
Subject: Re: ������������̣���������������
Date: 1998/04/29
Message-ID: <3OIEKQ$8Kf@bbs.nju.edu.cn>
X-Deja-AN: 348919330
X-Filename: Java/M.893837786.A
Organization: nju_bbs
Newsgroups: cn.bbs.comp.lang.java