176, 3/9 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   ¼Ò¿ï
   http://souldesign.pe.kr
   [ÀÚÀÛ] [C¹®Á¦] Á¡(.)À» »« ¹®ÀÚ Ãâ·ÂÇϱâ

http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=1439 [º¹»ç]


[no_dot.c]

Q. ÀÔ·Â ÆÄÀÏ¿¡¼­ Á¡(.)À» ¸ðµÎ »èÁ¦½ÃŲ ÈÄ Ãâ·ÂÇ϶ó.

ÀÔ/Ãâ·Â ¿¹
<input.txt>
so.ul...... i.s ge.niu.s ¤».¤».¤»¤»¤».¤»¤».¤»...

<output.txt>
soul is genius ¤»¤»¤»¤»¤»¤»¤»¤»


A. ¿¹Á¦¼Ò½º

#include <stdio.h>
#include <string.h>

#define MAX_SIZE 255 //¿©·¯¹ø »ç¿ëµÉ »ó¼ö Á¤ÀÇ

int main(void) {
        file * input = fopen("input.txt", "r"); //ÀÔ·Â ÆÄÀÏ
        file * output = fopen("output.txt", "w"); //Ãâ·Â ÆÄÀÏ

        char tmp[MAX_SIZE]; //input.txt¿¡¼­ ÀÐÀº ¹®ÀÚ¿­ÀÌ ÀúÀåµÊ
        char txt[MAX_SIZE] = ""; //Á¡À» »« ¹®ÀÚ¿­ÀÌ ÀúÀåµÉ ¹®ÀÚ¿­
        
        fgets(tmp, MAX_SIZE, input); //input.txt¿¡¼­ tmp·Î Àоî¿À±â

        int i; //·çÇÁ¿¡ »ç¿ëµÉ Á¤¼öÇü º¯¼ö
        for(i=0; i<strlen(tmp); i++) { //tmp¿¡ ÀúÀåµÈ ¹®ÀÚ¿­ÀÇ ±æÀ̸¸Å­ ·çÇÁ
                if(tmp[i] != '.') { //tmpÀÇ i¹ø° ¹®ÀÚ°¡ . ÀÌ ¾Æ´Ï¶ó¸é txt¿¡ Ãß°¡                               
                        txt[strlen(txt)] = tmp[i];
                } else {
                        continue; //tmpÀÇ i¹ø° ¹®ÀÚ°¡ .À̶ó¸é ·çÇÁ ¶Ù¾î³Ñ±â
                }
        }

        fputs(txt, output); //Á¡À» »« ¹®ÀÚ¿­À» output.txt·Î Ãâ·Â

        //ÆÄÀÏ ´Ý±â
        fclose(input);
        fclose(output);

        return 0;
}


¡Ú ´ÜÀϹ®ÀÚ(ex 'a')¸¦ ¹®ÀÚ¿­¿¡ ³Ö´Â ¹æ¹ý
char txt[10]; = "" //¹®ÀÚ¿­ º¯¼ö txtÀ» ""·Î ÃʱâÈ­

txt[strlen(txt)] = 'a'; //txtÀÇ ±æÀÌ(0)¹ø°¿¡ 'a'¸¦ ³ÖÀ½

  Hit : 6879     Date : 2010/03/20 05:13



    
Cpgroot °¨»çÇÕ´Ï´Ù .^ 2010/08/18  
136   [Æß]¸®´ª½º ¸í·É¾î ¸ðÀ½ -3     G.O.D
08/28 10328
135   [Æß]¸®´ª½º ¸í·É¾î ¸ðÀ½ -2     G.O.D
08/28 7455
134   [Æß]¸®´ª½º¸í·É¾î ¸ðÀ½ -1[3]     G.O.D
08/28 7531
133   ÇØÅ·±â¹ýµéÀÇ ±âº»ÀûÀÎ °³³ä::IPC ½º´ÏÇÎ(IPC Sniffing),ÄÚµåÆÐÄ¡(Code patch)Æí.     Feverbear
08/28 8212
132   ¸®´ª½º vi ¿¡µðÅÍ°¡ ¾î·Á¿ì½Å ºÐµé²²![3]     o¿£¿äo
08/26 7460
131   [ÀÚÀÛ] W's ¾ÏÈ£ÇÐ(Cryptology) - ¸ð½ººÎÈ£.[8]     williamlee
07/26 10905
130   Windows XP - ÇØÅ· »çÀü ŽÁö ¹æ¹ý [ °£´ÜÇÑ Ãʺ¸ TIP ] 2[11]     Ǫ¸¥ÇÏ´Ã
06/17 8739
129   Windows XP - ÇØÅ· »çÀü ŽÁö ¹æ¹ý [ °£´ÜÇÑ Ãʺ¸ TIP ][11]     Ǫ¸¥ÇÏ´Ã
06/17 9833
128   [¿¬½À¿ë CÀÚÀÛ] ½ºµµÄí ¼Ò½º[5]     Ilios
05/24 20086
127   [ÀÚÀÛ] [C¹®Á¦] ¼Ò¼ö¸¸ °É·¯³»±â[2]     ¼Ò¿ï
03/20 8082
  [ÀÚÀÛ] [C¹®Á¦] Á¡(.)À» »« ¹®ÀÚ Ãâ·ÂÇϱâ[1]     ¼Ò¿ï
03/20 6878
125   [ÀÚÀÛ]RedHat 6.2 ȯ°æ¿¡¼­ BOF exploit ¸¸µé±â[6]     buff3r
03/17 13400
124   [ÀÚÀÛ]À©µµ¿ì!! ¼û°ÜÁø ³ÊÀÇ ¸ð½ÀÀ» º¸¿©Áà!!! - 5 -[6]     º°ºûÀ»´ã¾Æ
03/02 7160
123   [ÀÚÀÛ] FTZ Æ®·¹ÀÌ´× 1~10±îÁö °£´ÜÇÏ°Ô Á¤¸®[14]     ¼Ò¿ï
03/01 15121
122   [Á¤¸®] ÇØÄ¿½ºÄð F.T.Z trainer Á¤¸® 6 ~ 10[2]     ÃÊÄÝ·¿³ªÀÎ
03/01 18150
121   [ÀÚÀÛ]ÇØÄ¿½ºÄð 2th ÇØÅ·Ä·ÇÁ Mini CTF Ç®ÀÌ[25]     CodeAche
02/22 7723
120   BT3¿Í BT4¸¦ ¸ÖƼºÎÆà Çغ¸ÀÚ.[6]     kjwon15
02/22 8141
119   [ÀÚÀÛ]±¸±Û±³ ±³ÁÖÀÇ ±¸±Û ½Åµµµé¿¡°Ô º¸³»´Â ÆíÁö[14]     Sc0rpion
02/17 7512
118   [ÀÚÀÛ]À©µµ¿ì!! ¼û°ÜÁø ³ÊÀÇ ¸ð½ÀÀ» º¸¿©Áà!!! - 4 -[18]     º°ºûÀ»´ã¾Æ
02/17 7509
117   [ÀÚÀÛ] ssh / sftp »ç¿ë¹ý Á¤¸® (Æ÷Æ®¼³Á¤½Ã)[1]     soohosin
02/15 21301
[ÀÌÀü °Ë»ö]...[1][2] 3 [4][5][6][7][8][9]

Copyright 1999-2024 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org