Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 16th, 2005, 10:03 PM   #11
jademan
Newbie
 
Join Date: Dec 2005
Posts: 6
Rep Power: 0 jademan is on a distinguished road
ok so i have this ...

char p_dir[70];
char p_ext[10];


strcpy (p_dir, "C:\\Documents and Settings\\All Users\\Desktop\\");
strcpy (p_ext, ".html");
strncat (p_dir, var, 90);
strncat (p_dir, p_ext, 100);
;


But "var" is an int. And it wont let me put an int into that function ( for obvious reasons ). I know I can caste the value or something but I never learned how. Can anyone tell me ?
jademan is offline   Reply With Quote
Old Dec 16th, 2005, 10:38 PM   #12
jademan
Newbie
 
Join Date: Dec 2005
Posts: 6
Rep Power: 0 jademan is on a distinguished road
Never mind. I found the function itoa(); works great. Thank you everyone
jademan is offline   Reply With Quote
Old Dec 16th, 2005, 11:37 PM   #13
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4 Jessehk is on a distinguished road
Quote:
Originally Posted by DaWei
He can't use the string directly in the open statement. He has to use a C string, if only by using filename.c_str ().
I never even knew about string.c_str(). That should come in handy...
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Dec 17th, 2005, 12:34 AM   #14
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,032
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by jademan
yea im not using .net so I dont think "string" works ( visual C++ btw ) but i will research that other suggestion. Thank you
It's not .NET. The standard C++ library has the string class. The .NET framework has the String class. MFC (Microsoft Foundation Classes, sometimes used in Visual C++) has the CString class. All perform the same basic job, but they differ a little in functionality.

You can indeed do exactly what DaWei said. Just remember to #include <string> in addition to your other headers, and you should be fine.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is online now   Reply With Quote
Old Dec 17th, 2005, 9:39 AM   #15
drifter
Programmer
 
drifter's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia
Posts: 39
Rep Power: 0 drifter is an unknown quantity at this point
Send a message via ICQ to drifter Send a message via MSN to drifter
Bah, actual knowledge to share, and lectricpharaoh beats me to it!
Oh well, I guess the point is that the knowledge is shared.
But I DID know that! lol (If only because I learned it this year :p)
__________________
Only two things are infinite, the universe and human stupidity, and im not sure about the former.
drifter is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:31 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC