From: "neohashi" Newsgroups: comp.os.msdos.djgpp Subject: [OT] Q: about I/O (getc()) Date: Thu, 28 Dec 2000 11:05:10 +0100 Organization: Posted Courtesy of Tele Danmark or one of its European Subsidiaries Lines: 52 Message-ID: <92f2te$54m$1@news.inet.tele.dk> NNTP-Posting-Host: ip241.odnxr2.ras.tele.dk X-Trace: news.inet.tele.dk 977997550 5270 195.249.49.241 X-Complaints-To: the appropriate department of the poster's provider X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com hi all, Can somebody tell my why the string (buf2) gets really wired? it looks like random charecters... :/ note... the test.txt only contains the string "name=tada;".... but printf() only prints "name" correctly. #include void get_string(FILE *f,char *c,int chk) { int i; do{ c[i] = getc(f); i++; }while(c[i-1] != chk); c[i-1] = '\0'; } int main(void) { int i; char buf1[80]; char buf2[80]; FILE *f = fopen("test.txt","r"); get_string(f,buf1,'='); get_string(f,buf2,';'); printf("%s%s",buf1,buf2); fclose(f); return 1; } what am I doing wrong? TIA oO[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]Oo Bjørn Hannibal Madsen/neohashi E-mail - neohashi AT mail DOT tele DOT dk Website - http://home6.inet.tele.dk/neohashi