Home Forums C Programming C Code to extraxct data from a file

Viewing 1 reply thread
  • Author
    Posts
    • #2172
      CandraU83d
      Participant

      Hi all,

      I have sorted some data into a file say output.txt. I need to get only the fields highlited in red into a file. Can some one help me with the code for the same

      Training File = .ts_ce_D_0.5-1.5_train3.sdf
      Training episode halted at max. epoch 100.
      Final Accuracy = 100.00 100.00 100.00
      TEST SET ts_ce_D_0.5-1.5_test3.sdf: Results on epoch 100
      Final Accuracy = 100.00 100.00 100.00
      TEST SET ts_ce_D_-10000.0–0.5_test3.sdf: Results on epoch 100
      Final Accuracy = 39.37 95.94 68.68
      TEST SET ts_ce_D_-0.5-0.5_test3.sdf: Results on epoch 100
      Final Accuracy = 95.55 98.23 96.91
      TEST SET ts_ce_D_0.5-1.5_test3.sdf: Results on epoch 100
      Final Accuracy = 100.00 100.00 100.00
      TEST SET ts_ce_D_1.5-10000.0_test3.sdf: Results on epoch 100
      Final Accuracy = 100.00 100.00 100.00
      TEST SET ts_ce_test3.sdf: Results on epoch 100
      Final Accuracy = 89.45 98.47 94.01

      Can someone please help me with teh C code to extract the pattern in RED from the file that i have given.

      Regards
      Subbu

    • #3504
      GWILouisaxwzkla
      Participant

      Is the code to be in c or c++? If in C++ you could easily type the proper combinations of input ( for the first line for example ):


      inputFile >> word; //get "Training"
      inputFile >> word;//get "File"
      inputFile >> word// get "="
      inputFile.getline ( fileString , MAX_LENGTH , 'n' ); //get ".ts_ce_D_0.5-1.5_train3.sdf"

      simple but tedious ………

Viewing 1 reply thread
  • The forum ‘C Programming’ is closed to new topics and replies.