C언어 TXT파일 중간내용 삭제질문드립니다.

-@Naver의 이미지

void insertCalendar() {
   char insert_content[150];
   char name[30];
   char semester[30];
 
   int s_year, s_month, s_day;
   int e_year, e_month, e_day;
 
   while (1) { //000을 입력할때까지 학사일정 추가
      //내용 안썼을경우 예외처리
      printf("학사일정 내용을 입력하세요(000입력시 종료):");
      scanf("%s", &name);
 
      if (!strcmp(name, "000")) {
         printf("입력 종료\n");
         break;
      }
 
      //입력안했을경우, 숫자 입력안했을경우 예외처리
      printf("시작연도 입력하세요:");
      scanf("%d", &s_year);
 
      printf("시작 월 입력하세요:");
      scanf("%d", &s_month);
 
      printf("시작 일 입력하세요:");
      scanf("%d", &s_day);
 
      printf("종료 연도 입력하세요:");
      scanf("%d", &e_year);
 
      printf("종료 월 입력하세요:");
      scanf("%d", &e_month);
 
      printf("종료 일 입력하세요:");
      scanf("%d", &e_day);
 
      printf("학기 정보를 입력하세요 :");
      scanf("%s", &semester);
 
      sprintf(insert_content, "%s %d.%d.%d~%d.%d.%d %s\n", name, s_year, s_month, s_day, e_year, e_month, e_day, semester);
 
      FILE* fa;
      fa = fopen("schedule_diary.txt", "a+"); //파일 이어쓰기, 파일 없을경우 생성
 
      fputs(insert_content, fa);
 
      fclose(fa);
   }
}

TXT에 텍스트 넣는 코드내용입니다.
위 내용대로 입력시 txt파일에

[처음 텍스트]
JAVA 2019.06.01~2019.06.01 JAVA공부
C 2019.06.02~2019.06.02 C언어공부
PYTHON 2019.06.03~2019.06.03 PYTHON공부

이렇게 입력이되고 중간내용 삭제시

[실행후 텍스트]
JAVA 2019.06.01~2019.06.01 JAVA공부
PYTHON 2019.06.03~2019.06.03 PYTHON공부

이렇게 나오게 하고싶습니다..

1. 파일 내용 메모리에 로딩
2. 새로운 파일 열기
3. 지울내용 지우기
4. 새로운 파일에 쓰기
위와같은 방법으로 된다고 하는데 해당 문자를 어떻게 찾아서 지우는 방법을 모르겠습니다..

혹시 코드예시본 있으신분 부탁드립니다 ㅜ

익명 사용자의 이미지

뭘 하겠다는 건지도 모르겠고, 어디까지 스스로 할 줄 아는 건지도 모르겠고...

작성된 schedule_diary.txt 파일을 다시 읽어들여서 화면에 출력하고, 새 파일에 고스란히 다시 쓰는 것까지 스스로 한번 해보세요.

십중팔구 텀프로젝트나 그 비슷한 종류의 과제라서 급하겠지만 차분히 차례차례 해 봅시다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.