Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

formatting char to 4 bits

Altera_Forum
Honored Contributor II
795 Views

Hello , In C , I am looking for a way to convert a char string , for example (0580) (4*8 bits) into (0580) (4 * 4bits) , other example : (0FED) (4 * 8 bits) into (0FED) (4 * 4 bits). Thanks for your help.

0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
94 Views

sscanf() with %x will work for that task.

Altera_Forum
Honored Contributor II
94 Views

Thanks Ted , it works. 

 

Regards 

 

Ben
Altera_Forum
Honored Contributor II
94 Views

strtoul() is probably better - much smaller and with more appropriate error reporting.

Reply