게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
[C/C++] system("clr") 에 대해서
게시물ID : computer_87335짧은주소 복사하기
작성자 : 메르타리움
추천 : 0
조회수 : 1292회
댓글수 : 4개
등록시간 : 2013/05/09 04:31:13

사용하고 있는 컴파일러 : visual studio 2010(c++)


출력문자들 지우는 함수로, system("clr")을 사용하고 있었는데,


프로그램을 실행시키면,


'clr'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 배치 파일이 아닙니다. 라는 문구가 뜨더라구여 ㅠㅠ


아래는 프로그램 소스 입니다 ㅠㅠ

->  그냥 방향키 입력하면 '#' 문자가 막 움직이는거예여;;



#include <stdio.h>

#include <stdlib.h>

#include <Windows.h>

#include <conio.h>


void gotoxy(int x,int y){


COORD Cur;

Cur.X=x;

Cur.Y=y;

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),Cur);

}


void main()

{

     int x,y;

     int ch;

 

     x=40;

     y=10;

     system("clr");

 

     for(;;) {

          gotoxy(x,y);

          putch('#');

          ch=getch();

          if (ch == 0xE0 || ch == 0) {

              ch=getch();

              switch (ch) {

              case 75:

                   x=x-1;

                   break;

              case 77:

                   x=x+1;

                   break;

              case 72:

                   y=y-1;

                   break;

              case 80:

                   y=y+1;

                   break;

              }

          } else {

              switch (ch) {

              case ' ':

                   system("clr");

                   break;

              case 'q':

              case 'Q':

                    exit(0);

              }

          }

     }

}

전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호