fgets 와 fscanf
Posted 2007. 6. 11. 10:40, Filed under: Study/Computer Sciencefgets : '\n' 문자를 만날 때까지 문자열을 읽어들이거나 지정된 배열의 크기만큼 분자열을 읽어들인다.
읽어들인 문자열의 뒤에는 NULL 문자가 삽입되므로 바로 출력에 사용할 수 있다.
아시는 분 부탁드립니다..^^;;;
int i;
scanf("%*d%d", &i);
그리고 []로 묶인 포맷 지정자를 scanlist라고 부릅니다. 문자열을 입력랄 때
scanlist에 명시된 글자만을 입력으로 받겠다는 뜻입니다.
예를 들어
char number[10];
scanf("%[0123456789]", number);
다차원 배열의 동적할당
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.
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.
(데이터 복구가 어느정도 가능한 이유)
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.
void Symbut::GetAbsolutePath()
{
char szBackup[200] = "";
char szCurrentPath[200] = "";
char drive[10] = "";
char dir[100] = "";
char fname[50] = "";
char ext[10] = "";
GetCurrentDirectory(200, szBackup); // 현재의 경로를 백업
_splitpath((LPCSTR)(LPCTSTR)szWorkFolder, drive, dir, fname, ext);
if (isalpha(dir[0])) // do not need to transform
return;
else
{
while (szWorkFolder.Find("..") == 0)
{
_chdir("..");
szWorkFolder.TrimLeft("..");
}
while (szWorkFolder.Find(".") == 0)
{
_chdir(".");
szWorkFolder.TrimLeft(".");
}
GetCurrentDirectory(200, szCurrentPath);
SetCurrentDirectory(szBackup);
szWorkFolder = szCurrentPath + szWorkFolder;
}
}