Contents

Develop
2003.04.23 10:59

[c] fgets() 함수 사용하기..

Views 7854 Comment 0
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
fgets() 함수를 사용하다 보면 문자열의 끝에 리턴(n)문자 까지 입력되게 된다.
이러한 경우 자신이 원하는 가공이 되지 않거나 원하는대로 출력되지 않는 경우가있다^^

문자열을 일단 입력 받게 되면 다음 함수로 문자열의 리턴문자를 제거해 주자..

fgets(str, MAX_LEN, stdin);
*strchr(str, 'n') = '';

또는

fgets(str, MAX_LEN, stdin);
str[strlen(str)-1] = '';


?

  1. [c] 근의 공식으로 2차방정식 풀기..

    Date2003.04.23 CategoryDevelop Byhooni Views7822
    Read More
  2. [c] 이진트리(binary tree) 샘플소스 (삽입, 삭제, 운행)

    Date2003.04.23 CategoryDevelop Byhooni Views7841
    Read More
  3. [mysql] 양력, 음력 DB데이터

    Date2013.04.23 CategoryDevelop Byhooni Views7843
    Read More
  4. [jsp] HelloServlet 출력문

    Date2003.04.23 CategoryDevelop Byhooni Views7850
    Read More
  5. [c] fgets() 함수 사용하기..

    Date2003.04.23 CategoryDevelop Byhooni Views7854
    Read More
  6. [c] i2osp 임시로.. ㅋㅋ

    Date2003.04.23 CategoryDevelop Byhooni Views7859
    Read More
  7. [java] RGB 색상 조절 버튼.. 스윙(swing)

    Date2013.04.23 CategoryDevelop Byhooni Views7869
    Read More
  8. [linux] 프로세스 관련 시스템콜

    Date2003.04.23 CategoryDevelop Byhooni Views7875
    Read More
  9. [c] 소수 구하기 #1 (한정된 숫자 내에 있는 소수 걸러내기)

    Date2003.04.23 CategoryDevelop Byhooni Views7881
    Read More
  10. [c] OpenGL 색 입방체의 회전(입체)

    Date2003.04.23 CategoryDevelop Byhooni Views7897
    Read More
  11. [java] 마우스 버튼 테스트.. swing..

    Date2013.04.23 CategoryDevelop Byhooni Views7906
    Read More
  12. [js] 자바스크립트 이벤트 핸들..

    Date2003.04.23 CategoryDevelop Byhooni Views7945
    Read More
Board Pagination Prev 1 ... 40 41 42 43 44 45 46 47 48 49 ... 98 Next
/ 98