How to write the data in txt file into other txt file [closed]

asked 2019-12-07 12:39:14 -0600

SunnyKatyara gravatar image

I am working on reading the data from one file "file1.txt" having format

0
0.0003
0.0006
  -0.0130
  -0.5542
  -0.2587
       2.2455e-04  -7.9772e-05   2.7506e-05
  -7.9772e-05   4.3190e-05  -1.7369e-05
   2.7506e-05  -1.7369e-05   3.0509e-05
0.03
0.0003
0.0006
  -0.0147
  -0.5546
  -0.2560
       2.2455e-04  -7.9772e-05   2.7506e-05
  -7.9772e-05   4.3190e-05  -1.7369e-05
   2.7506e-05  -1.7369e-05   3.0509e-05
0.06
0.0003
0.0006
  -0.0163
  -0.5551
  -0.2533
       2.2455e-04  -7.9772e-05   2.7506e-05
  -7.9772e-05   4.3190e-05  -1.7369e-05
   2.7506e-05  -1.7369e-05   3.0509e-05

and want to save in other file "file2.txt" with following format

0       -0.0130    2.2455e-04  -7.9772e-05   2.7506e-05
0.0003  -0.5542    -7.9772e-05   4.3190e-05  -1.7369e-05
0.0006  -0.2587    2.7506e-05  -1.7369e-05   3.0509e-05 
0.03    -0.0147    2.2455e-04  -7.9772e-05   2.7506e-05
0.0003  -0.5546    -7.9772e-05   4.3190e-05  -1.7369e-05
0.0006  -0.2560    2.7506e-05  -1.7369e-05   3.0509e-05
0.06    -0.0163    2.2455e-04  -7.9772e-05   2.7506e-05
0.0003  -0.5551    -7.9772e-05   4.3190e-05  -1.7369e-05
0.0006  -0.2533    2.7506e-05  -1.7369e-05   3.0509e-05

I am working on C++ programming. I know its simple question and i have also given a many try to solve it but failed. If any one can help, i will be thankful.

Thank You

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by gvdhoorn
close date 2019-12-08 02:26:31.111546

Comments

I'm sorry, but this is not a ROS question. It reads like a C++ issue.

As we have far too many questions here already, we must try to stay on-topic as much as possible.

Because of this, I've closed your question. Please post it on a forum dedicated to these kind of issues, such as Stack Exchange or Stack Overflow.

gvdhoorn gravatar image gvdhoorn  ( 2019-12-08 02:27:40 -0600 )edit