- CVI 정보나눔(www.cvi.kr)
- 스터디
- 질문답변
질문,답변
글 수 1,629
구지훈님께서 남기신 글입니다.
>
> 디렉토리 만들기를 하려고 합니다.
> 만약 디렉토리가 있으면 만들지 않습니다.
>
> if (SetDir (Dir_name) < 0)
> MakeDir (Dir_name);
>
> 이렇게 했더니만. 디렉토기가 있는 경우 SetDir (Dir_name) 여기서 에러가 나버리네요. 어떻게 해야하죠?
>
> 조언 부탁합니다.
>
안녕하세요..야리싸내라구 합니다..^^ 까궁...
주말에 시골가서 일하다보니...답변이 많이 늦었네요..^^;;
일단 SetDir에 대해서 함..알아보입시다..
int SetDir (char directoryName[]);
Purpose
Sets the current working directory to the directory you specify. To change the default drive, use SetDrive.
Parameter
Input Name Type Description
directoryName string New current working directory.
The directory name parameter must NOT contain a drive letter. To change the default drive, use the SetDrive function.
Return Value
Name Type Description
result integer Result of the operation.
Return Codes
Code Description
0 Success.
-1 Specified directory not found or out of memory.
말그대로...현재의 디렉토리를 특정 디렉토리로 바꾸는 겁니다..
님의 위의 코드로는 특정 디렉토리가 없으면 디렉토리를 새로 만드는 코드인데요...
디렉토리가 있으면 에러가 발생한다는 것은 return값이 에러(-1)인가요?
아니면 NON - FATAL RUN TIME ERROR 인가요?
전자의 경우..
디렉토리가 있는데 에러값이 -1이라면...
혹시...드라이버 문자(C:,D:)가 포함 되어 있지는 않나요? ...^^...
위의 설명에 보면 특정 디렉토리 이름에는 드라이버 문자가 포함 되면 안된다고 되어 있군요... ^^
후자의 경우...
NON-FATAL RUN-TIME ERROR가 발생하면서 POP-UP 창이 나타나는 가요?
그럴경우에는 다음의 함수를 Main함수 초기에 넣으세요..
DisableBreakOnLibraryErrors(); //CVI 자체 에러메시지 출력 금지
이 함수는 대부분의 CVI 초기에 넣어야 할만큼 중요한 함수입니다.
( 물론 debug모드에서만 입니다...^^ )
CVI에서는 자체 에러메시지를 출력합니다.
예를 들어서 파일 입출력을 행할시에 다음과 같이 하면
fp = fopen("aaa.txt","rt");
if(fp==NULL) printf("화일이 없습니다.");
이렇게 했을 경우 aaa.txt라는 파일이 있을 경우에는 그냥 넘어가지만
파일이 존재하지 않을 경우에는 다음 if문에 오기전에 fopen함수에서
에러 메세지 창이 나타납니다...함..해보세요..^^
이러한 cvi에러메시지를 출력하는 것을 금지하는 함수가 아래의 함수입니다.
If debugging is enabled, this function directs LabWindows/CVI not to display a runtime error dialog box when a National Instruments library function reports a error.
You can use this function in conjunction with EnableBreakOnLibraryErrors to temporarily suppress the Break on library errors feature around a segment of code.
This function does not affect the state of the Break on library errors checkbox in the Run Options dialog of the Project Window.
If debugging is disabled, this function has no effect. (Debugging is enabled when the debugging level in the Run Options dialog of the Project Window is set to Standard or Extended.)
/*-------------------- Prototype ---------------------*/
void DisableBreakOnLibraryErrors (void);
>
> 디렉토리 만들기를 하려고 합니다.
> 만약 디렉토리가 있으면 만들지 않습니다.
>
> if (SetDir (Dir_name) < 0)
> MakeDir (Dir_name);
>
> 이렇게 했더니만. 디렉토기가 있는 경우 SetDir (Dir_name) 여기서 에러가 나버리네요. 어떻게 해야하죠?
>
> 조언 부탁합니다.
>
안녕하세요..야리싸내라구 합니다..^^ 까궁...
주말에 시골가서 일하다보니...답변이 많이 늦었네요..^^;;
일단 SetDir에 대해서 함..알아보입시다..
int SetDir (char directoryName[]);
Purpose
Sets the current working directory to the directory you specify. To change the default drive, use SetDrive.
Parameter
Input Name Type Description
directoryName string New current working directory.
The directory name parameter must NOT contain a drive letter. To change the default drive, use the SetDrive function.
Return Value
Name Type Description
result integer Result of the operation.
Return Codes
Code Description
0 Success.
-1 Specified directory not found or out of memory.
말그대로...현재의 디렉토리를 특정 디렉토리로 바꾸는 겁니다..
님의 위의 코드로는 특정 디렉토리가 없으면 디렉토리를 새로 만드는 코드인데요...
디렉토리가 있으면 에러가 발생한다는 것은 return값이 에러(-1)인가요?
아니면 NON - FATAL RUN TIME ERROR 인가요?
전자의 경우..
디렉토리가 있는데 에러값이 -1이라면...
혹시...드라이버 문자(C:,D:)가 포함 되어 있지는 않나요? ...^^...
위의 설명에 보면 특정 디렉토리 이름에는 드라이버 문자가 포함 되면 안된다고 되어 있군요... ^^
후자의 경우...
NON-FATAL RUN-TIME ERROR가 발생하면서 POP-UP 창이 나타나는 가요?
그럴경우에는 다음의 함수를 Main함수 초기에 넣으세요..
DisableBreakOnLibraryErrors(); //CVI 자체 에러메시지 출력 금지
이 함수는 대부분의 CVI 초기에 넣어야 할만큼 중요한 함수입니다.
( 물론 debug모드에서만 입니다...^^ )
CVI에서는 자체 에러메시지를 출력합니다.
예를 들어서 파일 입출력을 행할시에 다음과 같이 하면
fp = fopen("aaa.txt","rt");
if(fp==NULL) printf("화일이 없습니다.");
이렇게 했을 경우 aaa.txt라는 파일이 있을 경우에는 그냥 넘어가지만
파일이 존재하지 않을 경우에는 다음 if문에 오기전에 fopen함수에서
에러 메세지 창이 나타납니다...함..해보세요..^^
이러한 cvi에러메시지를 출력하는 것을 금지하는 함수가 아래의 함수입니다.
If debugging is enabled, this function directs LabWindows/CVI not to display a runtime error dialog box when a National Instruments library function reports a error.
You can use this function in conjunction with EnableBreakOnLibraryErrors to temporarily suppress the Break on library errors feature around a segment of code.
This function does not affect the state of the Break on library errors checkbox in the Run Options dialog of the Project Window.
If debugging is disabled, this function has no effect. (Debugging is enabled when the debugging level in the Run Options dialog of the Project Window is set to Standard or Extended.)
/*-------------------- Prototype ---------------------*/
void DisableBreakOnLibraryErrors (void);