자바 파일을 c 파일로 바꿔야하는데 어떻게 해야할지모르겟습니다 도아주실수있으신가요ㅠ
알렉산더
질문 제목 :자바 파일을 c 파일로 바꿔야하는데 어떻게 해야할지모르겟습니다 도아주실수있으신가요ㅠ지금 제가 자바 프로그램이 있는데 이걸 c로 바꿔야하는데 어떻게 해야할지 잘모르겠습니다..ㅠ질문 내용 :
import java.io.printwriter;
import java.io.fileoutputstream;
import java.io.fileinputstream;
import java.io.filenotfoundexception;
import java.util.scanner;
import java.util.arraylist;
public class expand {
final private static string marker = #include “;
private static int markercount;
private static arrayliststring expansion = new arrayliststring();public static void fileread(string inputname){ scanner scan = null;
printwriter output = null;
p;string line = null;
try {
scan = new scanner(new fileinputstream(inputname));
output = new printwriter(new fileoutputstream(out.txt));
} catch(filenotfoundexception e) {
system.out.println(error. terminating...);}
while (scan.hasnextline()){
//recursive
if (line.startswith(marker)){
markercount++;
string iname =line.substring(marker.length()).trim();
iname = iname.replace(\, );
fileread(iname);
}
else {
expansion.add(line);
}
}
// loop through entire arraylist of lines
for (int i = 0; i expansion.size(); i++)
{
// print to output file
output.println(expansion.get(i));
}
scan.close();
output.close();
}// end fileread // main
public static void main(string[] args) {
try {
output = new printwriter(new fileoutputstream(args[1]));
} catch(filenotfoundexception e) {
system.out.println(error. terminating... not able to open outputfile);
system.exit(0);
}
fileread(args[0]);
}// end main
}// end expand
이게 자바 코드입니다 이걸 c로 바꿔야하는데 잘모르겟습니다아직..ㅠ
-
유희
C를 공부하시고, 자바에서 함수가 하는 행동을 하는 C 함수를 만드시고, 혹은 C에있는 함수를 활용하여 만드시면 될거같습니다.
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2685477 | 소수점이하 출력하는거요 | 널위해 | 2025-02-18 |
2685449 | printf배우고있는데요 궁금한게있어요 (8) | 꽃큰 | 2025-02-18 |
2685393 | c언어 질문이요.... | 붕붕 | 2025-02-18 |
2685365 | 윈도우7에서 visual studio c++6.0 (1) | 빛길 | 2025-02-17 |
2685317 | segmentation fault가 나요 | 가람 | 2025-02-17 |
2685292 | 다중스택질문 | 올해1살 | 2025-02-17 |
2685231 | C언어와 닷넷에 대해서 질문!! (2) | 설아 | 2025-02-16 |
2685206 | VisualBasic 과 DEV++ 의 장단점과 만든 파일 호환 가능하나요? | 에드워드 | 2025-02-16 |
2685154 | 배열 크기조절 | 해찬솔 | 2025-02-15 |
2685124 | 수정이거 제가 뭐가 잘못한거죠 ? | 아이돌 | 2025-02-15 |
2685096 | 포인터의 고수분들 모두 보세요!! 제발 ㅠ_ㅠ 헷갈려헷갈려..갈려헷.. (7) | 치킨마루 | 2025-02-15 |
2685045 | 전처리기 질문 | 치에미 | 2025-02-14 |
2685016 | 오류 좀 확인해 주시면 감사하겠습니다 | 초코맛사탕 | 2025-02-14 |
2684917 | 알고리즘을 이용한 행렬의 전치// 문제다운 문제네요. | 뿡뿡 | 2025-02-13 |
2684868 | 양방향 연결리스트에서 실행도중 죽는 이유좀 찾아주세요. (2) | 예다움 | 2025-02-13 |
2684844 | 시계프로그램인데 도저히 모르겠어요ㅠ (1) | 비내리던날 | 2025-02-12 |
2684812 | 레포트좀도와주세요ㅠㅠ (2) | 갈매빛 | 2025-02-12 |
2684780 | 채팅창 흉내내보려고하는데요 ㅜ.ㅜ (1) | 바름 | 2025-02-12 |
2684729 | 내일 시험인데 메모리 그리는것좀 도와주세요 ㅠ (1) | 상처주지마 | 2025-02-11 |
2684701 | 버퍼 관련 질문 3가지 (이전거랑 달라요) | 한국녀 | 2025-02-11 |