Please help…

Home Forums C Programming Please help…

Viewing 0 reply threads
  • Author
    Posts
    • #2224
      GarnetHuynh
      Participant

      Hi,

      I have the following C code, which does the following :-

      Takes the brt file name from character 1 of the input filename (ALLSMFAS.ref) and creates a new file (A.brt) as follows :-

      ALLSMFAS.ref


      AD,B,0424,0415,89375,,A,2,,80,,
      AD,B,0424,0417,89375,,A,1,,82,,
      AD,B,0416,0410,89375,,B,2,,-7,2,
      BN,B,0135,0094,65625,,D,,,0,1,H
      BN,B,0338,0337,65824,,B,,,-18,1,
      BN,B,0334,0339,65824,,C,,,65,,
      CA,T,,SREC,47221,,C,,R,0,,
      CA,T,,X171,47221,,A,6,,60,,
      CA,T,,X173,47221,,A,5,,60,,
      CC,B,1783,1574,48231,,C,1,,60,,
      CC,B,1783,1576,48231,,C,2,,60,,
      CC,B,1783,1578,48231,,C,3,,60,,

      A.brt


      B0424041589375 B0424041789375 B0416041089375 B0135009465625 B0338033765824 B0334033965824
      T SREC47221 T X17147221 T X17347221 B1783157448231 B1783157648231 B1783157848231

      But now, I need to create output files from the column 1 of the input file and each time the value in column 1 changes,

      a new file is created.

      So for input file :-

      ALLSMFAS.ref



      AD,B,0424,0415,89375,,A,2,,80,,
      AD,B,0424,0417,89375,,A,1,,82,,
      AD,B,0416,0410,89375,,B,2,,-7,2,
      BN,B,0135,0094,65625,,D,,,0,1,H
      BN,B,0338,0337,65824,,B,,,-18,1,
      BN,B,0334,0339,65824,,C,,,65,,
      CA,T,,SREC,47221,,C,,R,0,,
      CA,T,,X171,47221,,A,6,,60,,
      CA,T,,X173,47221,,A,5,,60,,
      CC,B,1783,1574,48231,,C,1,,60,,
      CC,B,1783,1576,48231,,C,2,,60,,
      CC,B,1783,1578,48231,,C,3,,60,,
      :
      :

      the following needs to be the output files.

      AD.brt


      B0424041589375 B0424041789375 B0416041089375

      BN.brt


      B0135009465625 B0338033765824 B0334033965824

      CA.brt


      T SREC47221 T X17147221 T X17347221

      CC.brt


      B1783157448231 B1783157648231 B1783157848231

      and so on ….

      In the above code, I am stuck up at the following place, where I believe the logic for reading the first column of the file

      and for each change in the value, a new file is created has to be put.

      Request you, if you could please help me with the appropriate code for this.

      Thanks a lot.

      Marconi.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
Share
Tweet
Share
Pin