New User

Reply

Join Date: Oct 2005
Posts: 6
Reputation: ricciola is an unknown quantity at this point 
Solved Threads: 0
ricciola ricciola is offline Offline
Newbie Poster

New User

 
0
  #1
Oct 25th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 108
Reputation: prog-bman is an unknown quantity at this point 
Solved Threads: 3
prog-bman prog-bman is offline Offline
Junior Poster

Re: New User

 
0
  #2
Oct 25th, 2005
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
Join me on IRC:
Server: irc.daniweb.com
Channel: #C++

Chat Via:
http://daniweb.com/chat/minichat.php
or
Your favorite IRC client.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: ricciola is an unknown quantity at this point 
Solved Threads: 0
ricciola ricciola is offline Offline
Newbie Poster

Concatenation of a string with a number

 
0
  #3
Oct 26th, 2005
Originally Posted by prog-bman
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?
Thank you

PS. Excuse me for the english!!!!
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 1,671
Reputation: Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all Lerner is a name known to all 
Solved Threads: 261
Lerner Lerner is offline Offline
Posting Virtuoso

Re: New User

 
0
  #4
Oct 26th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: ricciola is an unknown quantity at this point 
Solved Threads: 0
ricciola ricciola is offline Offline
Newbie Poster

Search string in a text file

 
0
  #5
Nov 3rd, 2005
Originally Posted by Lerner
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC