fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7.  
  8. float voltage,current1,current2;
  9. char voltages[20], current[20], dtm[100];
  10.  
  11. strcpy( dtm, "VOLTAGE 0.231023459 CURRENT -0.234334567 0.345511234");
  12. sscanf( dtm, "%s %f %s %f %f", voltages,&voltage,current,&current1, &current2);
  13.  
  14. printf("voltage = %f \n",voltage);
  15. printf("current1 = %f \n",current1);
  16. printf("current2 = %f \n",current2);
  17.  
  18. return(0);
  19. }
Success #stdin #stdout 0s 2008KB
stdin
Standard input is empty
stdout
voltage = 0.231023 
current1 = -0.234335 
current2 = 0.345511