Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] how to merge(concatenate) two or more char

Status
Not open for further replies.

jsbhalla88

Member level 1
Member level 1
Joined
Mar 3, 2015
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Visit site
Activity points
314
hi.
i know this is simple but I am not able to do it..
I am reading characters from software UART, and storing them in char array. I acan only read one char at a time, so I am using char array.
now, I want to merge(concatenate) two/more characters from the array in which I received the char from UART.
I have tried using built in functions strncat, strcat..they should work.., but didn't in my case..
I am using MikroC pro for programming PIC18F45K22 microcontroller

can anyone suggest.?
 

Can it be that you didn't care for the difference between characters and null terminated strings? E.g. if you use strncat(), you still need a terminating null for the first string.
 

Just terminate the array with null character ('\0') and you will have a string. No need to concatenate.
 

thank you guys for the reply..
I tried to print the whole array with
Code:
Soft_UART_Write_Text(array_name);
and it worked..earlier I was using Soft_UART_Write();, it was printing just the first character.
and then used atoi() to convert to integer.. This what I needed to do..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top