자바 파일을 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에있는 함수를 활용하여 만드시면 될거같습니다.
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2655328 | 함수에서 포인터 (3) | 모아 | 2024-05-18 |
2655299 | 아이콘바꾸는법..? | 소 | 2024-05-18 |
2655271 | scanf 입력받으면 쭉 실행되는.. (5) | ComeOn | 2024-05-18 |
2655184 | 이 세개 프로그램좀 해결해주실.... 고수님들???? (3) | 말달리자 | 2024-05-17 |
2655129 | 다차원 배열 원소들 주소계산하는거 질문이요~ | 터전 | 2024-05-17 |
2655103 | AVRstudio MoveAxis. MoveLine 함수질문 | 앨버트 | 2024-05-16 |
2655072 | 콘솔창의 위치와 크기를 정하고 싶습니다. | 딥레드 | 2024-05-16 |
2655044 | 자료구조랑 online judge site에 대해서 질문있습니다... (1) | 뽀송뽀송 | 2024-05-16 |
2655016 | 별찍기 문제 중 이해안되는 부분이 있어요... | 도전중 | 2024-05-16 |
2654986 | 입력받은 성적을 배열에 저장하기 (3) | 안녕나야 | 2024-05-15 |
2654959 | ===========-이런거 미리 지정하는법 (1) | 김자영 | 2024-05-15 |
2654930 | 도와주십시요 ㅜㅜ 자료구조 ㅜㅜ | 도널드 | 2024-05-15 |
2654881 | PID 모듈 검색 부분 질문합니다 . | 이름없음 | 2024-05-14 |
2654850 | 조건에 만족하는 다음 수를 찾고 싶습니다. | 초엘 | 2024-05-14 |
2654790 | 두파일간 byte단위 txt파일 복사 中 | 슬찬 | 2024-05-14 |
2654768 | 사전만들기 입니다. | 여우By | 2024-05-13 |
2654716 | c언어 고수님들 답좀적어주세요 급합니다 ㅠㅠ | 한말글 | 2024-05-13 |
2654688 | c언어 ㅠㅠ 너 무 어려 워요 ㅠ 도와주세요!! | 별빛 | 2024-05-13 |
2654659 | 구구단 소스 궁금한 점 도움 부탁드립니다! (2) | 미련곰팅이 | 2024-05-12 |
2654633 | 오류가 무었인가요..? (2) | 단순랩퍼 | 2024-05-12 |