fork download
  1. #include<stdio.h>
  2. #define BUFSZ 4
  3. int main()
  4. {
  5. //int size=BUFSZ-1;
  6. char attrValue[11]="keshakesha";
  7. char scanBuf[BUFSZ];
  8. //char temp[BUFSZ];
  9. //int num = sprintf(out,"%*.*s",BUFSZ,BUFSZ,fmyStr);
  10.  
  11. //sprintf(out,"%s",fmyStr);
  12. snprintf(scanBuf,sizeof(scanBuf),"%s",attrValue);
  13. int num=sscanf(scanBuf,"%s",scanBuf);
  14. //int num= sscanf(fmyStr,"%*.*s",&size,out);
  15. printf("items read: %d\n",num);
  16. printf("String read: %s\n",scanBuf);
  17. //printf("%d\n",n);
  18. //printf("%s\n",temp);
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
items read: 1
String read: kes