외규장각 도서 환수 모금 캠페인

Search Results for 'Study/Computer Science'

60 POSTS

  1. 2007.06.11 scanf
  2. 2007.06.11 fgets 와 fscanf
  3. 2007.06.11 fscanf 의 입력 필터링, 선택 기능
  4. 2007.06.11 2차원 배열
  5. 2007.06.08 휴지통 (recycle bin -Windows) 2

scanf

Posted 2007. 6. 11. 13:45, Filed under: Study/Computer Science

사용자 삽입 이미지



scanf와 관련한 좀 더 자세한 내용.

공백 문자나 변환 할 수 없는 문자를 만나면 입력받기를 중단한다.
seach_set 이나 할당 금지 문자를 지정할 수 있음
Response : ,

fgets 와 fscanf

Posted 2007. 6. 11. 10:40, Filed under: Study/Computer Science
사용자 삽입 이미지


사용자 삽입 이미지


fgets : '\n' 문자를 만날 때까지 문자열을 읽어들이거나 지정된 배열의 크기만큼 분자열을 읽어들인다.
        읽어들인 문자열의 뒤에는  NULL 문자가 삽입되므로 바로 출력에 사용할 수 있다.
Response : ,

fscanf 의 입력 필터링, 선택 기능

Posted 2007. 6. 11. 10:30, Filed under: Study/Computer Science
[질문] fscanf(fd,"%*[^\n]"); 이게 무슨 뜻인지 좀 가르쳐 주세요~~^^;;
원문 링크

Q.  
코드 분석중에 fscanf(fd,"%*[^\n]");

이런 코드를 발견 했습니다..파일로 부터 읽는 것 같은데.. %*[^\n]
이것이 무엇을 의미하는지 모르겠습니다..

아시는 분 부탁드립니다..^^;;;


A. 
*는 입력을 읽기는 읽되 어떤 변수에 저장하지 않고 건너뛰는 것입니다.

예를 들어

int i;
scanf("%*d%d", &i);

에서 "1 2"를 입력하면 1은 건너뛰고 i의 값은 2가 됩니다.

그리고 []로 묶인 포맷 지정자를 scanlist라고 부릅니다. 문자열을 입력랄 때
scanlist에 명시된 글자만을 입력으로 받겠다는 뜻
입니다.

예를 들어


char number[10];
scanf("%[0123456789]", number);

에서 "123abc"를 입력하면 number는 "123"이 됩니다.
scanlist 안의 ^는 scanlist에 명시된 글자를 제외한 것만 입력하겠다는 뜻이고요.
그러니까 "%*[^\n]"은 end-of-line('\n')이 나오기 전까지 읽어서 버리겠다는 뜻입니다.

Submitted by doldori on 목, 2006/08/17 - 5:49pm.
---------------
이런 것도 있었군~
메뉴 선택 같은 부분에서 지정된 값 이외에 쓸데없는 입력이 들어오는 것을 필터링할 때 사용하면 굉장히 유용할 듯..
Response : ,

2차원 배열

Posted 2007. 6. 11. 00:11, Filed under: Study/Computer Science

다차원 배열의 동적할당

사용자 삽입 이미지

먼저 1번처럼 1차원 배열을 가리키는 포인터의 배열을 할당한 후에 2번과 같이 1차원 배열들을 할당해주어야 2차원 배열의 공간을 할당할 수 있다. 그렇지 않을 경우에 접근 제한 에러를 발생시키게 된다.


함수에 다차원 배열 전달하기

char array[100][100] 과 같이 선언된 이차원 배열을 함수로 넘겨줄 때 char** 타입으로 배열의 시작 주소를 넘기면 안됨. 이처럼 넘겨줄 경우에 배열의 주소 연산을 할 수가 없음.
이는 메모리 상에서 1차원으로 저장된 2차원 배열에서 인덱스를 통해 배열 요소에 접근 할 때인덱스가 하나 증가하면 얼마만큼의 메모리 공간을 이동해서 접근해야하는지 알 수 없기 때문이다. 

array[1][2] 와 같이 참조하였을 때 배열의 크기에 따라 해당하는 배열 요소의 메모리 상에서의 위치가 달라진다는 것.

그러므로 함수의 파라메터로 넘겨줄 때 char [][100] 과 같은 형태로 전달해주어야한다.

---------------
이상ㅡ 어제 창희 숙제 도와주다가 삽질한 것들 -_-;
예전에 다 했던 것들이고 굉장히 기본적인 것인데도 잘 까먹는다.
Response : ,

휴지통 (recycle bin -Windows)

Posted 2007. 6. 8. 10:56, Filed under: Study/Computer Science
얼마전에 비트 디펜더를 설치하고 나서 이상하게 파일을 삭제하는게 느려졌다 -_-
그래서 다른 AV 프로그램과 충돌을 일으킨건가 해서 삭제한 했는데.. 그래도 계속 다른 모든 기능이 멀쩡하게 동작함에도 불구하고 파일 삭제가 굉장히 느린 것이었다.

왜 그런가 왜 그런가 계속 고민해 봤는데 shift + delete 로 완전히 삭제할 때는 별로 느리지 않은 데서 갑자기 번쩍! 이런..
휴지통이 가득 찼군 -_-;

근데 이건 너무하잖아.. 가득 찼으면 가득 찼다고 말을 해주던가 -_- 지혼자 꾸역꾸역 안에서 제일 오래된 파일을 찾아서 지우고 새로운거 넣고.. 너무 느리다 ㅋ

괜히 애꿎은 비트 디펜더만 지웠네.. 역시 뭐든지 원인을 알아내는게 가장 어렵구나.
어제 상대경로 변경하는 함수 디버깅할 때도 _chdir 때문인지는 모르고 괜히 ini 파일만 계속 쳐다보고 왜 안읽어지는지 고민했는데 ㅋ

다음은 휴지통 관련 위키피디아 글

Link

General

The recycle bin was introduced in Windows 95 as a means of keeping accidentally deleted files, users can then review what is in the recycle bin before removing files permanently. Before, undeletion was the only way to recover accidentally deleted files. Recycle Bin holds data that not only lists deleted files, but also the date, time and the path of those files. The recycle bin is opened like a regular Windows Explorer folder and the files are viewed similarly. Deleted files may be removed from the recycle bin by restoring them with a command.

The recycle bin's icon indicates whether or not something is in the recycle bin. If the icon is empty, there are no files in the recycle bin. If there are objects in the recycle bin on the icon, there are files in the recycle bin.

Prior to Windows Vista, the default configuration of the Recycle Bin was to hold 10% of the total capacity of the host hard disk drive. For example, on a hard drive with a capacity of 20 gigabytes, the recycle bin will hold up to 2 gigabytes. If the recycle bin fills up to maximum capacity, the oldest files will be deleted in order to accommodate the newly deleted files. If a file is too large for the recycle bin, the user will be prompted to permanently delete the file instead. The maximum possible size of the recycle bin is 3.99 gigabytes in all versions of Windows except Vista.

The same feature exists in other operating systems under a different name, for example in Apple's Mac OS and various Linux distributions, it is named 'Trash'. It was a feature of the Macintosh OS since the beginning. It is believed that the recycle bin was first invented by Xerox PARC.
The recycle bin was introduced in Windows 95 as a means of keeping accidentally deleted files, users can then review what is in the recycle bin before removing files permanently. Before, undeletion was the only way to recover accidentally deleted files. Recycle Bin holds data that not only lists deleted files, but also the date, time and the path of those files. The recycle bin is opened like a regular Windows Explorer folder and the files are viewed similarly. Deleted files may be removed from the recycle bin by restoring them with a command.

How the recycle bin works

Files stored in the Recycle Bin in its physical location are renamed as Dxy.ext where x represents the drive name such as "c", "d" and so on, y a sequential number starting at 0 and ext being the file's original file name extension. The file names are kept as is when viewed from the main recycle bin. A hidden file is created, without an extension, called "info2". This file stores the original files' paths and file names so when the file is removed from the recycle bin and returned to its original directory, the original file name is kept as is. When the file is "deleted" the space on the disk is designated to be erased over by whatever files then are saved on the disk. For instance, if you have a picture deleted on the recycling bin, it is still physically stored on the disk until other data is written over it. In other words, the data are not erased, but the address marking the data is.
(데이터 복구가 어느정도 가능한 이유)

Known issues

While the recycle bin is useful for hard drives, it does not recycle files from removable media. For instance, a file deleted from an SD card or a floppy disk will not be moved to the recycle bin.

Having a big disk and full recycle bin can considerably slow down deleting files. Right-clicking on recycle bin and selecting "empty recycle bin" resolves the issue easily.

(이게 바로 내가 겪었던 문제!!!! 해결책은 무지 단순 -_-; )

Also, the Recycle Bin icon cannot be deleted from the desktop like other icons. Deleting a registry key from the Windows Registry resolves this issue. The key varies with the version of the operating system. However in the Windows Vista operating system, the recycle bin can be deleted from the desktop.

Response : ,

« Previous : 1 : ··· : 6 : 7 : 8 : 9 : 10 : 11 : 12 : Next »

Recent Posts

Recent Comments

Recent Trackbacks

Total hit (Today , Yesterday )

Admin Write Post