<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://dislab.hufs.ac.kr/w/index.php?action=history&amp;feed=atom&amp;title=%EA%B8%B0%EB%B3%B8_%EC%98%88%EC%A0%9C_%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8_%EB%B0%8F_%EC%84%A4%EB%AA%85</id>
	<title>기본 예제 프로그램 및 설명 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://dislab.hufs.ac.kr/w/index.php?action=history&amp;feed=atom&amp;title=%EA%B8%B0%EB%B3%B8_%EC%98%88%EC%A0%9C_%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8_%EB%B0%8F_%EC%84%A4%EB%AA%85"/>
	<link rel="alternate" type="text/html" href="http://dislab.hufs.ac.kr/w/index.php?title=%EA%B8%B0%EB%B3%B8_%EC%98%88%EC%A0%9C_%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8_%EB%B0%8F_%EC%84%A4%EB%AA%85&amp;action=history"/>
	<updated>2026-05-25T15:00:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://dislab.hufs.ac.kr/w/index.php?title=%EA%B8%B0%EB%B3%B8_%EC%98%88%EC%A0%9C_%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8_%EB%B0%8F_%EC%84%A4%EB%AA%85&amp;diff=215&amp;oldid=prev</id>
		<title>Swpark: Created page with &quot;FirstClass === 첫 번째 Java 프로그램 === &lt;syntaxhighlight lang=&quot;java&quot;&gt; public class FirstClass {     public static void main(String[] args) {         System.out.println(&quot;hello&quot;);     } } &lt;/syntaxhighlight&gt;운영체제 계통도  === 첫 번째 C 프로그램 === &lt;syntaxhighlight lang=&quot;c&quot;&gt; #include &lt;stdio.h&gt;  int main() {     fprintf(stdio, &quot;hello\n&quot;); } &lt;/syntaxhighlight&gt;  * vscode 실행&lt;sy...&quot;</title>
		<link rel="alternate" type="text/html" href="http://dislab.hufs.ac.kr/w/index.php?title=%EA%B8%B0%EB%B3%B8_%EC%98%88%EC%A0%9C_%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8_%EB%B0%8F_%EC%84%A4%EB%AA%85&amp;diff=215&amp;oldid=prev"/>
		<updated>2022-07-18T03:41:32Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/wiki/File:Week01.FirstClass.java.png&quot; title=&quot;File:Week01.FirstClass.java.png&quot;&gt;thumb|FirstClass&lt;/a&gt; === 첫 번째 Java 프로그램 === &amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt; public class FirstClass {     public static void main(String[] args) {         System.out.println(&amp;quot;hello&amp;quot;);     } } &amp;lt;/syntaxhighlight&amp;gt;&lt;a href=&quot;/wiki/File:OS_%EA%B3%84%ED%86%B5%EB%8F%84.png&quot; title=&quot;File:OS 계통도.png&quot;&gt;thumb|운영체제 계통도&lt;/a&gt;  === 첫 번째 C 프로그램 === &amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt; #include &amp;lt;stdio.h&amp;gt;  int main() {     fprintf(stdio, &amp;quot;hello\n&amp;quot;); } &amp;lt;/syntaxhighlight&amp;gt;  * vscode 실행&amp;lt;sy...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[File:Week01.FirstClass.java.png|thumb|FirstClass]]&lt;br /&gt;
=== 첫 번째 Java 프로그램 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public class FirstClass {&lt;br /&gt;
    public static void main(String[] args) {&lt;br /&gt;
        System.out.println(&amp;quot;hello&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[File:OS 계통도.png|thumb|운영체제 계통도]]&lt;br /&gt;
&lt;br /&gt;
=== 첫 번째 C 프로그램 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    fprintf(stdio, &amp;quot;hello\n&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* vscode 실행&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
mkdir projects&lt;br /&gt;
cd projects&lt;br /&gt;
mkdir helloworld&lt;br /&gt;
cd helloworld&lt;br /&gt;
code .&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* Build [[File:Vscode에서 mingw64로 빌드.png|thumb|mingw64 g++ build]]&lt;br /&gt;
** 터미널 / 작업 실행 선택&lt;br /&gt;
* 실행 : 터미널에서 직접 helloworld.exe를 실행한다.&lt;br /&gt;
&lt;br /&gt;
=== 첫 번째 C++ 프로그램 ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;hello&amp;quot; &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Unix에서 프로세스가 생성될 때 마다 열리는 파일들 ===&lt;br /&gt;
* Unix에서 프로세스가 만들어지면 생성되는 세 개의 파일. 모든 프로세스는 세 개의 파일이 열려(open)있다.&lt;br /&gt;
** Standard input : stdin(C), cin(C++), System.in(Java)&lt;br /&gt;
** Standard output : stdout(C), cout(C++), System.out(Java)&lt;br /&gt;
** Standard error : stderr(C), cerr(C++), System.err(Java)&lt;br /&gt;
&lt;br /&gt;
* Standard output 예제&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot;&amp;gt;#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;fcntl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
    int fd;&lt;br /&gt;
    char buf[10];&lt;br /&gt;
    &lt;br /&gt;
    strcpy(buf, &amp;quot;hello\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    fd = open(&amp;quot;stdoutput.c&amp;quot;, O_RDONLY);&lt;br /&gt;
    printf(&amp;quot;%d\n&amp;quot;, fd);&lt;br /&gt;
&lt;br /&gt;
    write(1, buf, sizeof(buf));&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* 실행 결과&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
3&lt;br /&gt;
hello&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*# 사용자가 작성한 프로그램(user program)에서 첫 번째 open 하여 얻은 file descriptor가 0이 아니라 3이다. 왜냐하면 0, 1, 2는 이미 stdin, stdout, stderr로 사용중이기 때문이다.&lt;br /&gt;
*# &amp;lt;code&amp;gt;write&amp;lt;/code&amp;gt; 함수는 파일에 데이터를 기록하는 함수이다. 이 함수는 첫 번째 인자로 대상 파일의 file descriptor 번호가 필요한데, &amp;lt;code&amp;gt;write(1, ...)&amp;lt;/code&amp;gt;에서 1은 stdout을 뜻한다. 그러므로 출력이 화면으로 나온다.&lt;/div&gt;</summary>
		<author><name>Swpark</name></author>
	</entry>
</feed>