Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #90874
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-05-19 10:14 -0700 |
| References | <c9733ddb-7f97-4fcf-9dad-a4481d1d3e5d@googlegroups.com> <mailman.144.1432053932.17265.python-list@python.org> |
| Message-ID | <307ed4c5-b140-4f11-844f-db5fcc592dd7@googlegroups.com> (permalink) |
| Subject | Re: Convert c file to csv file(unix format) in python |
| From | umasrinath88@gmail.com |
On Tuesday, May 19, 2015 at 10:15:43 PM UTC+5:30, Mihamina Rakotomandimby wrote:
> On 05/19/2015 07:30 PM, umasrinath88@gmail.com wrote:
> > Can anyone help me in converting .c file to csv file (unix format).
> >
> >
> Would you give a sample?
Hi Mihamina,
I have sent you the complete work folder.
thyncHextoC.py is python script used to convert .hex to .c structure file
Open command prompt window and type below command.
>python thyncHextoC.py <mention hex file to be converted>
example: python thyncHextoC.py 18052015_1640_STM_5_08_DVT.hex
stm32Image.c file is created.
this .c file has to be converted to csv file.
I was following manual steps as below:(But want to automate now)
3)Open stm32Image.c file in notepad++
Delete first 23 lines of data in the file(including this line "const flashImage_t flashImageData[] ={")
The .C file must contain only hex bytes now.
4)Select all the hex bytes and go to edit option->Blank operation-> Remove leading and trailing spaces
next go again edit option->Line operations-> Remove empty lines containing blank characters
Remove the comma(,) from last hex byte till end of the file.
This can be achieved using Alt+Shift+end and scroll down until the last hex byte.
Note:Donot modify last line 0,0,0 }; of the file. Let it remain as it is.
5)Once all the above steps are done, Save the file and in command prompt execute below command for converting .c to .csv file
>ren stm32Image.c <file name.csv>
example:ren stm32Image.c 28022015_1140_EVT.csv
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Convert c file to csv file(unix format) in python umasrinath88@gmail.com - 2015-05-19 09:30 -0700
Re: Convert c file to csv file(unix format) in python Mihamina Rakotomandimby <mihamina.rakotomandimby@rktmb.org> - 2015-05-19 19:48 +0300
Re: Convert c file to csv file(unix format) in python umasrinath88@gmail.com - 2015-05-19 10:14 -0700
Re: Convert c file to csv file(unix format) in python Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-19 18:20 +0000
Re: Convert c file to csv file(unix format) in python umasrinath88@gmail.com - 2015-05-19 12:26 -0700
Re: Convert c file to csv file(unix format) in python Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-20 01:57 +0000
Re: Convert c file to csv file(unix format) in python Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-22 19:48 +0000
Re: Convert c file to csv file(unix format) in python Grant Edwards <invalid@invalid.invalid> - 2015-05-19 19:36 +0000
csiph-web