I have a simple prob that I dont seem to be able to solve. The itemName is suppose to be Item#....where # is to be the itemNum generated in the program.
I have tried itemName=itemNum but I get an ascii character where the number is suppose to be. Any suggestions?
sprintf( itemName, "Item%d", itemNum );
And you don't even need the strcpy - it's all in one call
Thanx for the reply but that wont work for me...firstly, I need to store the itemName and itemNum into a linked list for processing and secondly I need it in C++....cant have C :(
> firstly, I need to store the itemName and itemNum into a linked list
Yeah, so what's your question?
It's a simple char array with some characters in it, you never said it was a linked list.
So its a linked list of char arrays, big deal - works either way.
> I need it in C++....cant have C
But you used strcpy - exactly how religious do you want to be?
My fault...should have been more precise....let me rephrase the whole thing. I have a linked list with certain items in it. Two of these items are itemName[MAX] and itemNum.
itemNum : generated in the program and used with itemName
itemName : uses the value in itemNum e.g Item5 or Item200
my prob is I cant read in the value from itemNum into itemName. I just need a method of doing it. Later in the program certain items are used and the search is done according to the itemName.