import java.io.*;
class line {
public static void main(String args[]) throws IOException {
int match = args[0].charAt(0);
FileInputStream fin = new FileInputStream(args[1]);
LineNumberInputStream in = new LineNumberInputStream(fin);
int ch;
in.setLineNumber(1);
while((ch = in.read()) != -1) {
if(ch == match) {
System.out.println("'" + (String)ch + "'at line " + in.getLineNumber());
System.exit(0);
}
}
System.out.println(ch + "not found");
System.exit(-1);
}
}
1)이 소스를 이용해서 substring과 compareTo를 이용해서 문자열을
찾아야 하거든요
그런데 잘 이해가 가질 않아서요
file을 스트링으로 바꿔서 해야 하나요?
2)다음 질문
파일입력스트림과 파일출력스트림을 사용해서 파일에서 5개의 임의의 숫
자를 받아들여 정렬한후 파일에 오름차순을오 출력하는 프로그램이 필요
합니다
카페 게시글
Q & A..
파일입출력에 관한 질문(도와주세요)
popo
추천 0
조회 50
03.11.25 10:41
댓글 0
다음검색