Re: [Vietlug] day la doan text tui dinh gui len

2006-09-15 Hội thoại hong pham
chao moi nguoi! Minh muon truyen con tro a vao trong ham nhap. Sau do goi ham hien thi de hien thi ra. Van de o day la sau khi ra khoi ham nhap cac gia tri nhap vao bien a ko con nua. Minh da thu chay chuong trinh nay voi dieu kien bien a la public. Nhung bi jo minh muon truyen no qua ham vay minh phai lam thie nao xin moi nguoi chi jao. Minh cam on. Day la doan code cua minh#includestdio.h#includestdlib.hint* nhap(int *a,int n){ a=(int*)malloc(n*sizeof(int)); if(a!=NULL) for (int i=0;in;i++)  {   printf("a[%d]=",i);   scanf("%d",a[i]);} else  printf("\nLoi!!!"); return a;}void HienThi(int * a,int n) { for (int i=0;in;i++) printf("
 %d",a+i);}int main(){ int n,*a; printf("\nNhap so chieu:"); scanf("%d",n); a=nhap(a,n); HienThi(a,n); free(a); return 0;}Ngo Trung Nhan [EMAIL PROTECTED] wrote: http://c-faq.com/stdio/scanfprobs.htmlOn 9/14/06, NAHieu <[EMAIL PROTECTED]> wrote: On 9/14/06, G TT <[EMAIL PROTECTED]> wrote:  Vi` "white spaces" ddu+o+.c xem nhu+ "string terminator", ne^n xem ma~:   #inclue   int main()  {  char str[80];  printf("Enter some words (or 'ctrl-c' to break): ");  scanf("%s", str);  == buffer length unchecked HERE It is a very *stupid* idea to
 use scanf() to get input! fgets() is certainly a better choice in this case. RTFM! Cheers, H - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ VietLUG-users mailing list VietLUG-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vietlug-users-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with
 pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___VietLUG-users mailing listVietLUG-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/vietlug-users 
		Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-15 Hội thoại G TT
Co' ly' do gi` ma` ba.n pha?i allocate memory cho a trong ha`m nhap(), 
ro^`i free no' o+? ha`m main()?
Theo nguye^n ta('c OO thi`  ne^n tra'nh su+. cho^`ng che'o data cu?a ca'c 
ha`m, hay classes!

---
 Date: Fri, 15 Sep 2006 01:51:49 -0700
 From: [EMAIL PROTECTED]
 To: vietlug-users@lists.sourceforge.net
 Subject: Re: [Vietlug] day la doan text tui dinh gui len
 
 chao moi nguoi! Minh muon truyen con tro a vao trong ham nhap. Sau do goi ham 
 hien thi de hien thi ra. Van de o day la sau khi ra khoi ham nhap cac gia tri 
 nhap vao bien a ko con nua. Minh da thu chay chuong trinh nay voi dieu kien 
 bien a la public. Nhung bi jo minh muon truyen no qua ham vay minh phai lam 
 thie nao xin moi nguoi chi jao. Minh cam on. Day la doan code cua minh
 #includestdio.h
 #includestdlib.h
 int* nhap(int *a,int n){
 a=(int*)malloc(n*sizeof(int));
 if(a!=NULL)
 for (int i=0;in;i++)
   {
   printf(a[%d]=,i);
   scanf(%d,a[i]);
 }
 else
   printf(\nLoi!!!);
 return a;
 }
 void HienThi(int * a,int n) {
   for (int i=0;in;i++)
   printf(  %d,a+i);
 }
 int main(){
   int n,*a;
 printf(\nNhap so chieu:);
 scanf(%d,n);
 a=nhap(a,n);
 HienThi(a,n);
 free(a);
 return 0;
 }
 Ngo Trung Nhan [EMAIL PROTECTED] wrote:
 http://c-faq.com/stdio/scanfprobs.html
 On 9/14/06, NAHieu wrote:
  On 9/14/06, G TT wrote:
   Vi` white spaces ddu+o+.c xem nhu+ string terminator, ne^n xem ma~:
  
   #inclue
   int main()
   {
   char str[80];
   printf(Enter some words (or 'ctrl-c' to break): );
   scanf(%s, str); == buffer length unchecked HERE
 
  It is a very *stupid* idea to use scanf() to get input!
  fgets() is certainly a better choice in this case.
  RTFM!
 
 
  Cheers,
  H
 
  -
  Using Tomcat but need to do more? Need to support web services, security?
  Get stuff done quickly with pre-integrated technology to make your job 
  easier
  Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
  http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
  ___
  VietLUG-users mailing list
  VietLUG-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/vietlug-users
 
 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 VietLUG-users mailing list
 VietLUG-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/vietlug-users
 ---
 Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
 countries) for 2¢/min or less.

_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-14 Hội thoại NAHieu
On 9/14/06, G TT [EMAIL PROTECTED] wrote:
 Vi` white spaces ddu+o+.c xem nhu+ string terminator, ne^n xem ma~:

 #inclue stdio.h
 int main()
 {
 char str[80];
 printf(Enter some words (or 'ctrl-c' to break): );
 scanf(%s, str);  == buffer length unchecked HERE

It is a very *stupid* idea to use scanf() to get input!
fgets() is certainly a better choice in this case.
RTFM!


Cheers,
H

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-14 Hội thoại Ngo Trung Nhan
http://c-faq.com/stdio/scanfprobs.html

On 9/14/06, NAHieu [EMAIL PROTECTED] wrote:
 On 9/14/06, G TT [EMAIL PROTECTED] wrote:
  Vi` white spaces ddu+o+.c xem nhu+ string terminator, ne^n xem ma~:
 
  #inclue stdio.h
  int main()
  {
  char str[80];
  printf(Enter some words (or 'ctrl-c' to break): );
  scanf(%s, str);  == buffer length unchecked HERE

 It is a very *stupid* idea to use scanf() to get input!
 fgets() is certainly a better choice in this case.
 RTFM!


 Cheers,
 H

 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 VietLUG-users mailing list
 VietLUG-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/vietlug-users


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-14 Hội thoại G TT
That was an attempt to answer to the following original question.
Are there some more experts on the field?
 
Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
mã nguồn của mình:
#include stdio.h
 
int main()
{
   char str[80];
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 
   return 0;
}
và đây là kết quả mà mình mong đợi:
Enter some words:hello word
 The first word you entered is:hello
 Enter some words:who are u?
 The first word you entered is:who
nhưng kết quả mà mình thu được lại là:
Enter some words: hello word
 The first word you entered is : hello
 Enter some words: The first word you entered is : word
Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
cám ơn!!!
---
 Date: Thu, 14 Sep 2006 14:36:26 +0200
 From: [EMAIL PROTECTED]
 To: vietlug-users@lists.sourceforge.net
 Subject: Re: [Vietlug] day la doan text tui dinh gui len
 
 http://c-faq.com/stdio/scanfprobs.html
 
 On 9/14/06, NAHieu [EMAIL PROTECTED] wrote:
  On 9/14/06, G TT [EMAIL PROTECTED] wrote:
   Vi` white spaces ddu+o+.c xem nhu+ string terminator, ne^n xem ma~:
  
   #inclue stdio.h
   int main()
   {
   char str[80];
   printf(Enter some words (or 'ctrl-c' to break): );
   scanf(%s, str);  == buffer length unchecked HERE
 
  It is a very *stupid* idea to use scanf() to get input!
  fgets() is certainly a better choice in this case.
  RTFM!
 
 
  Cheers,
  H
 
  -
  Using Tomcat but need to do more? Need to support web services, security?
  Get stuff done quickly with pre-integrated technology to make your job 
  easier
  Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
  http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
  ___
  VietLUG-users mailing list
  VietLUG-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/vietlug-users
 
 
 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 VietLUG-users mailing list
 VietLUG-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/vietlug-users

_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1loc=us
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-13 Hội thoại G TT
Vi` white spaces ddu+o+.c xem nhu+ string terminator, ne^n xem ma~:

#inclue stdio.h
int main()
{
char str[80];
printf(Enter some words (or 'ctrl-c' to break): );
scanf(%s, str);
printf(The first word entered is: %s\n, str);
while(str == \n)
{
scanf(%s, str);
}
return 0;
}

while loop ddo.c nhu+~ng chu+~ co`n la.i, cho dde^'n khi ga(.p return char 
(\n) trong ca^u!





 From: [EMAIL PROTECTED]
 To: vietlug-users@lists.sourceforge.net
 Date: Tue, 12 Sep 2006 10:46:30 -0700
 Subject: Re: [Vietlug] day la doan text tui dinh gui len
 
 Theo standard C library, thi` scanf tru+~ data tu+` stdin va`o argument 
 str[80] chu+'  kho^ng co`n dde^? trong keyboard buffer  ma` ba.n 
 fflush(stdin).
 DDe^` nghi. reset str[80]  cho la^`n thu+' hai, thay vi` fflush(stdin).
 
 ---
  Date: Tue, 12 Sep 2006 07:42:08 -0700
  From: [EMAIL PROTECTED]
  To: vietlug-users@lists.sourceforge.net
  Subject: Re: [Vietlug] day la doan text tui dinh gui len
  
  theo tui duoc biet thi no khong he co tac dung vi du co hay ko co thi ket 
  qua van vay!!! Hic  help me
  Hong Tran Duc [EMAIL PROTECTED] wrote:
  #include stdio.h
  int main()
  {
  char str[80];
  printf(Enter some words: );
  scanf(%s, str);
  printf(The first word you entered is : %s\n, str );
  fflush(stdin); //is it work ?
  printf(Enter some words: );
  scanf(%s, str);
  printf(The first word you entered is : %s\n, str );
  return 0;
  }
  On 9/12/06, Larry Nguyen wrote:
   On 5:50:50 am 09/11/06 hong pham wrote:
   
   
Stay in the know. Pulse on the new Yahoo.com. Check it
   out.
  
   Gu+?i la.i du`m Hong Pham
  
   Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
   mã nguồn của mình:
   #include stdio.h
  
   int main()
   {
   char str[80];
   printf(Enter some words: );
   scanf(%s, str);
   printf(The first word you entered is : %s\n, str );
  
   printf(Enter some words: );
   scanf(%s, str);
   printf(The first word you entered is : %s\n, str );
  
   return 0;
   }
   và đây là kết quả mà mình mong đợi:
   Enter some words:hello word
   The first word you entered is:hello
   Enter some words:who are u?
   The first word you entered is:who
   nhưng kết quả mà mình thu được lại là:
   Enter some words: hello word
   The first word you entered is : hello
   Enter some words: The first word you entered is : word
   Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
   đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
   nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
   cám ơn!!!
  
  
   -
   Using Tomcat but need to do more? Need to support web services, security?
   Get stuff done quickly with pre-integrated technology to make your job 
   easier
   Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
   http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
   ___
   VietLUG-users mailing list
   VietLUG-users@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/vietlug-users
  
  --
  nm.
  -
  Using Tomcat but need to do more? Need to support web services, security?
  Get stuff done quickly with pre-integrated technology to make your job 
  easier
  Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
  http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
  ___
  VietLUG-users mailing list
  VietLUG-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/vietlug-users
  ---
  Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
  countries) for 2/min or less.
 
 _
 Express yourself with gadgets on Windows Live Spaces
 http://discoverspaces.live.com?source=hmtag1loc=us
 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 VietLUG-users mailing list
 VietLUG-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/vietlug-users

_
Use Messenger to talk to your IM friends, even those on Yahoo!
http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe
-
Using Tomcat but need to do more

Re: [Vietlug] day la doan text tui dinh gui len

2006-09-12 Hội thoại Hong Tran Duc
#include stdio.h

int main()
{
  char str[80];
printf(Enter some words: );
scanf(%s, str);
printf(The first word you entered is : %s\n, str );

fflush(stdin); //is it work ?

printf(Enter some words: );
scanf(%s, str);
printf(The first word you entered is : %s\n, str );

  return 0;
}

On 9/12/06, Larry Nguyen [EMAIL PROTECTED] wrote:
 On 5:50:50 am 09/11/06 hong pham [EMAIL PROTECTED] wrote:
 
 
  #32;Stay in the know. Pulse on the new Yahoo.com.  Check it
  out.

 Gu+?i la.i du`m Hong Pham

 Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
 mã nguồn của mình:
 #include stdio.h

 int main()
 {
char str[80];
  printf(Enter some words: );
  scanf(%s, str);
  printf(The first word you entered is : %s\n, str );

  printf(Enter some words: );
  scanf(%s, str);
  printf(The first word you entered is : %s\n, str );

return 0;
 }
 và đây là kết quả mà mình mong đợi:
 Enter some words:hello word
  The first word you entered is:hello
  Enter some words:who are u?
  The first word you entered is:who
 nhưng kết quả mà mình thu được lại là:
 Enter some words: hello word
  The first word you entered is : hello
  Enter some words: The first word you entered is : word
 Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
 đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
 nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
 cám ơn!!!


 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 VietLUG-users mailing list
 VietLUG-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/vietlug-users



-- 
nm.
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-12 Hội thoại hong pham
theo tui duoc biet thi no khong he co tac dung vi du co hay ko co thi ket qua van vay!!! Hic help meHong Tran Duc [EMAIL PROTECTED] wrote: #include "stdio.h"int main(){  char str[80];printf("Enter some words: ");scanf("%s", str);printf("The first word you entered is : %s\n", str );fflush(stdin); //is it work ?printf("Enter some words: ");scanf("%s", str);printf("The first word you entered is : %s\n", str );  return 0;}On 9/12/06, Larry Nguyen <[EMAIL PROTECTED]> wrote: On 5:50:50 am 09/11/06 hong pham <[EMAIL PROTECTED]> wrote: Stay in the know. Pulse on the new Yahoo.com.  Check it  out. Gu+?i la.i du`m Hong Pham Mình vừa gặp phải
 một lỗi rất khó hiểu. Đây là đoạn mã nguồn của mình: #include "stdio.h" int main() {char str[80];  printf("Enter some words: ");  scanf("%s", str);  printf("The first word you entered is : %s\n", str );  printf("Enter some words: ");  scanf("%s", str);  printf("The first word you entered is : %s\n", str );return 0; } và đây là kết quả mà mình mong đợi: "Enter some words:hello word  The first word you entered is:hello  Enter some words:who are u?  The first word you entered is:who" nhưng kết quả mà mình thu được lại là: "Enter some words: hello word  The first word you entered is : hello  Enter some words: The first word you entered is : word" Không thể hiểu nổi tại sao hàm scanf()
 lại chỉ hoạt động đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin) nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin cám ơn!!! - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642 ___ VietLUG-users mailing list VietLUG-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vietlug-users-- nm.-Using Tomcat but need
 to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___VietLUG-users mailing listVietLUG-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/vietlug-users 
		Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-12 Hội thoại G TT
Theo standard C library, thi` scanf tru+~ data tu+` stdin va`o argument 
str[80] chu+'  kho^ng co`n dde^? trong keyboard buffer  ma` ba.n 
fflush(stdin).
DDe^` nghi. reset str[80]  cho la^`n thu+' hai, thay vi` fflush(stdin).

---
 Date: Tue, 12 Sep 2006 07:42:08 -0700
 From: [EMAIL PROTECTED]
 To: vietlug-users@lists.sourceforge.net
 Subject: Re: [Vietlug] day la doan text tui dinh gui len
 
 theo tui duoc biet thi no khong he co tac dung vi du co hay ko co thi ket qua 
 van vay!!! Hic  help me
 Hong Tran Duc [EMAIL PROTECTED] wrote:
 #include stdio.h
 int main()
 {
 char str[80];
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 fflush(stdin); //is it work ?
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 return 0;
 }
 On 9/12/06, Larry Nguyen wrote:
  On 5:50:50 am 09/11/06 hong pham wrote:
  
  
   Stay in the know. Pulse on the new Yahoo.com. Check it
  out.
 
  Gu+?i la.i du`m Hong Pham
 
  Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
  mã nguồn của mình:
  #include stdio.h
 
  int main()
  {
  char str[80];
  printf(Enter some words: );
  scanf(%s, str);
  printf(The first word you entered is : %s\n, str );
 
  printf(Enter some words: );
  scanf(%s, str);
  printf(The first word you entered is : %s\n, str );
 
  return 0;
  }
  và đây là kết quả mà mình mong đợi:
  Enter some words:hello word
  The first word you entered is:hello
  Enter some words:who are u?
  The first word you entered is:who
  nhưng kết quả mà mình thu được lại là:
  Enter some words: hello word
  The first word you entered is : hello
  Enter some words: The first word you entered is : word
  Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
  đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
  nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
  cám ơn!!!
 
 
  -
  Using Tomcat but need to do more? Need to support web services, security?
  Get stuff done quickly with pre-integrated technology to make your job 
  easier
  Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
  http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
  ___
  VietLUG-users mailing list
  VietLUG-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/vietlug-users
 
 --
 nm.
 -
 Using Tomcat but need to do more? Need to support web services, security?
 Get stuff done quickly with pre-integrated technology to make your job easier
 Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
 ___
 VietLUG-users mailing list
 VietLUG-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/vietlug-users
 ---
 Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ 
 countries) for 2/min or less.

_
Express yourself with gadgets on Windows Live Spaces
http://discoverspaces.live.com?source=hmtag1loc=us
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-11 Hội thoại Larry Nguyen
On 5:50:50 am 09/11/06 hong pham [EMAIL PROTECTED] wrote:


 #32;Stay in the know. Pulse on the new Yahoo.com.  Check it
 out.

Gu+?i la.i du`m Hong Pham

Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
mã nguồn của mình:
#include stdio.h

int main()
{
   char str[80];
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );

   return 0;
}
và đây là kết quả mà mình mong đợi:
Enter some words:hello word
 The first word you entered is:hello
 Enter some words:who are u?
 The first word you entered is:who
nhưng kết quả mà mình thu được lại là:
Enter some words: hello word
 The first word you entered is : hello
 Enter some words: The first word you entered is : word
Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
cám ơn!!!


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-11 Hội thoại Manh Cuong
Vi` stdin va^~n co`n chua string thu+' 2, 3 trong buffer cho du` du`ng fflush. 
Cho ne^n ngay sau khi go.i ha`m scanf la^`n thu+' 2 thi` string trong buffer 
stdin do' ngay la^.p tu+'c duoc ga'n cho bie^'n str. Cho ne^n trong truong hop 
nay, le^.nh scanf da~ duoc thuc hien roi , chu ko phai la` chi? thuc hie^n duoc 
1 la^`n.
Cuong.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Nguyen
Sent: Tuesday, September 12, 2006 12:12 PM
To: vietlug-users@lists.sourceforge.net
Subject: Re: [Vietlug] day la doan text tui dinh gui len

On 5:50:50 am 09/11/06 hong pham [EMAIL PROTECTED] wrote:


 #32;Stay in the know. Pulse on the new Yahoo.com.  Check it
 out.

Gu+?i la.i du`m Hong Pham

Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
mã nguồn của mình:
#include stdio.h

int main()
{
   char str[80];
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );

   return 0;
}
và đây là kết quả mà mình mong đợi:
Enter some words:hello word
 The first word you entered is:hello
 Enter some words:who are u?
 The first word you entered is:who
nhưng kết quả mà mình thu được lại là:
Enter some words: hello word
 The first word you entered is : hello
 Enter some words: The first word you entered is : word
Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
cám ơn!!!


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-11 Hội thoại Manh Cuong
Theo toi thi co the lam nhu sau:
Thay lenh scanf bang lenh fgets:
 printf(Enter some words: );
 scanf(%s, str);
-
fgets(str,80,stdin)
sau do' xu ly chuoi str. 

Manh Cuong.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Nguyen
Sent: Tuesday, September 12, 2006 12:12 PM
To: vietlug-users@lists.sourceforge.net
Subject: Re: [Vietlug] day la doan text tui dinh gui len

On 5:50:50 am 09/11/06 hong pham [EMAIL PROTECTED] wrote:


 #32;Stay in the know. Pulse on the new Yahoo.com.  Check it
 out.

Gu+?i la.i du`m Hong Pham

Mình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạn
mã nguồn của mình:
#include stdio.h

int main()
{
   char str[80];
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );
 
 printf(Enter some words: );
 scanf(%s, str);
 printf(The first word you entered is : %s\n, str );

   return 0;
}
và đây là kết quả mà mình mong đợi:
Enter some words:hello word
 The first word you entered is:hello
 Enter some words:who are u?
 The first word you entered is:who
nhưng kết quả mà mình thu được lại là:
Enter some words: hello word
 The first word you entered is : hello
 Enter some words: The first word you entered is : word
Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt động
đúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)
nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xin
cám ơn!!!


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-11 Hội thoại hong pham
vay theo ban lam the nao de khac phuc duoc tinh trang tren? Xin cam onManh Cuong [EMAIL PROTECTED] wrote: Vi` stdin va^~n co`n chua string thu+' 2, 3 trong buffer cho du` du`ng fflush. Cho ne^n ngay sau khi go.i ha`m scanf la^`n thu+' 2 thi` string trong buffer stdin do' ngay la^.p tu+'c duoc ga'n cho bie^'n str. Cho ne^n trong truong hop nay, le^.nh scanf da~ duoc thuc hien roi , chu ko phai la` chi? thuc hie^n duoc 1 la^`n.Cuong.-Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry NguyenSent: Tuesday, September 12, 2006 12:12 PMTo: vietlug-users@lists.sourceforge.netSubject: Re: [Vietlug] day la doan text tui dinh gui lenOn 5:50:50 am 09/11/06 hong pham <[EMAIL PROTECTED]> wrote:
  Stay in the know. Pulse on the new Yahoo.com.  Check it out.Gu+?i la.i du`m Hong PhamMình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạnmã nguồn của mình:#include "stdio.h"int main(){   char str[80]; printf("Enter some words: "); scanf("%s", str); printf("The first word you entered is : %s\n", str );  printf("Enter some words: "); scanf("%s", str); printf("The first word you entered is : %s\n", str );   return 0;}và đây là kết quả mà mình mong đợi:"Enter some words:hello word The first word you entered is:hello Enter some words:who are u? The first word you entered is:who"nhưng kết quả mà mình thu được lại là:"Enter some words: hello word The first word you entered is : hello Enter some words: The first word you entered is : word"Không thể hiểu nổi tại sao
 hàm scanf() lại chỉ hoạt độngđúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xincám ơn!!!-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___VietLUG-users mailing listVietLUG-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/vietlug-users-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly
 with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___VietLUG-users mailing listVietLUG-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/vietlug-users 
		Get your email and more, right on the  new Yahoo.com 
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users


Re: [Vietlug] day la doan text tui dinh gui len

2006-09-11 Hội thoại hong pham
ok!!! Toi se thu lai ngay bi jo. Tui se reply lai ngay khi co ket qua. Cam on ban!!!. Ah quen ban co nick ko? toi co the add nick cua ban duoc chu?Manh Cuong [EMAIL PROTECTED] wrote: Theo toi thi co the lam nhu sau:Thay lenh scanf bang lenh fgets: printf("Enter some words: "); scanf("%s", str);-fgets(str,80,stdin)sau do' xu ly chuoi str. Manh Cuong.-Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry NguyenSent: Tuesday, September 12, 2006 12:12 PMTo: vietlug-users@lists.sourceforge.netSubject: Re: [Vietlug] day la doan text tui dinh gui lenOn 5:50:50 am 09/11/06 hong pham <[EMAIL PROTECTED]> wrote:  Stay in the know. Pulse on the new
 Yahoo.com.  Check it out.Gu+?i la.i du`m Hong PhamMình vừa gặp phải một lỗi rất khó hiểu. Đây là đoạnmã nguồn của mình:#include "stdio.h"int main(){   char str[80]; printf("Enter some words: "); scanf("%s", str); printf("The first word you entered is : %s\n", str );  printf("Enter some words: "); scanf("%s", str); printf("The first word you entered is : %s\n", str );   return 0;}và đây là kết quả mà mình mong đợi:"Enter some words:hello word The first word you entered is:hello Enter some words:who are u? The first word you entered is:who"nhưng kết quả mà mình thu được lại là:"Enter some words: hello word The first word you entered is : hello Enter some words: The first word you entered is : word"Không thể hiểu nổi tại sao hàm scanf() lại chỉ hoạt
 độngđúng một lần. Ngay cả khi mình đã sử dụng hàm fflush(stdin)nhưng kết quả vẫn như cũ. Ai đó giúp mình với. Mình xincám ơn!!!-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___VietLUG-users mailing listVietLUG-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/vietlug-users-Using Tomcat but need to do more? Need to support web services, security?Get stuff done quickly with pre-integrated technology
 to make your job easierDownload IBM WebSphere Application Server v.1.0.1 based on Apache Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___VietLUG-users mailing listVietLUG-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/vietlug-users 
		 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
VietLUG-users mailing list
VietLUG-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vietlug-users