🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.java
2 messages
2 total messages Started by Radoslaw Poplawski Wed, 02 Apr 1997 11:38
Odczyt pliku w Javie
#457
Author: Radoslaw Poplawski
Date: Wed, 02 Apr 1997 11:38
34 lines
1558 bytes
public static boolean Czytaj(String Plik)
{
	try {
	File PlikWej = new File(Plik);
	FileInputStream strwej = new FileInputStream(PlikWej);
	int status;
	byte plik[] = new byte[20000]; //na wczytywany plik

	status = strwej.read(plik[]);

itd..... }


Czy ktos moze powiedziec dlaczego kompilator krzyczy na linii: "status
= strwej.read(plik[]);"??? Odpowiednie FileInputStream.read zaczyna
sie od:
--
public int read(byte  b[])                throws IOException
Reads up to b.length bytes of data from this input stream into an
array of bytes. This method blocks until some input is available.

Parameters:
b- the buffer into which the data is read

Returns:
the total number of bytes read into the buffer, or -1 is there is no
more data because the end of the file has been reached.
--
wiec wszystko chyba jest w porzadku, a kompilator krzyczy "missing
array dimension".

Radoslaw Poplawski (Wroclaw) http://yi.com/home/PoplawskiRadoslaw/
MotorCity: http://www.geocities.com/MotorCity/3416/
F1: http://www.geocities.com/MotorCity/3416/f1.html
Re: Odczyt pliku w Javie
#458
Author: Artur Biesiadowski
Date: Wed, 02 Apr 1997 11:55
18 lines
1105 bytes
Radoslaw Poplawski (radekp@usa.net) wrote:
: public static boolean Czytaj(String Plik)
: {
: 	try {
: 	File PlikWej = new File(Plik);
: 	FileInputStream strwej = new FileInputStream(PlikWej);
: 	int status;
: 	byte plik[] = new byte[20000]; //na wczytywany plik

: 	status = strwej.read(plik[]);

Powinno byc 
	status = strwej.read(plik);
Przy odwolaniach do tablicy jako calosci nie stosuje sie []
np. strwej.length a nie strwej[].length. To samo dotyczy przekazywania
parametrow.

Artur
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads