Hello! I'm a new user of this forum. I'm italian and I work like programmer. I need of some information about C code and I wish you help me!
Bye bye :D

Recommended Answers

All 4 Replies

Welcome to the forums.
1. When you have a problem(s). Ask a question releating to that problem.
2. Post any realated code with the problem.
3. Wait until someone like me, who is a genius, to help you with your problem ;).
Enjoy your stay at the Daniweb C And C++ forums and make sure you keep your arms and legs inside while you are here

Welcome to the forums.
1. When you have a problem(s). Ask a question releating to that problem.
2. Post any realated code with the problem.
3. Wait until someone like me, who is a genius, to help you with your problem ;).
Enjoy your stay at the Daniweb C And C++ forums and make sure you keep your arms and legs inside while you are here

Thanks!!!!
I would be a lot recognizing if you help me for this problem:
I have a text file and I would be searching on this file some word of this type "wordi" where i is a natural number. Since these words come written on this file second of a sure number j (that indicate the number of the inputs) es. j=2 in the file I'll find word1 and word2, I have tried to do a for cicle but I don't succeed to do a concatenation of the string (word) and the number (j).
Can you help me? :idea: :idea:
Thank you

PS. Excuse me for the english!!!! ;)

Within the file you are using all data is binary. When the file data is read into your program, your program converts that data into whatever it's been told to convert it into based on what variable is going to hold the information in the program. To concatenate to variables you can use a variety of techniques based on what the variable types are. If the variable types are both null terminated strings you can use strcat() to combine them into a single string. If the variables are both instances of the STL string class you can use the + operator to concatenate them. If one variable is a null terminated string and the other is a numerical variable you can use ssprintf() to concatenate them. If one variable is an instance of the STL string class and the other is a numerical variable you can use an istringstream to concatenate them. And so on.

Within the file you are using all data is binary. When the file data is read into your program, your program converts that data into whatever it's been told to convert it into based on what variable is going to hold the information in the program. To concatenate to variables you can use a variety of techniques based on what the variable types are. If the variable types are both null terminated strings you can use strcat() to combine them into a single string. If the variables are both instances of the STL string class you can use the + operator to concatenate them. If one variable is a null terminated string and the other is a numerical variable you can use ssprintf() to concatenate them. If one variable is an instance of the STL string class and the other is a numerical variable you can use an istringstream to concatenate them. And so on.

Thank you, I have resolved this problem using the sprintf function!!!
Now I have another problem. I have a function that search a string in a text file. This function return an int: 0 if the string I must be search isn't in the file, 1 otherwise.
The problem is: if the searching string is "input1" and in the file there is a string "counter_input1" the function return 1 instead must be return 0.
Bye :?:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.