Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Mar 5th, 2006, 8:04 PM   #1
myName
Programmer
 
Join Date: Oct 2005
Posts: 48
Rep Power: 0 myName is on a distinguished road
Convert char[14] to char *

How to convert char chA[14] to char *pointerA???


ifstream myInputFile("thisFile.txt");
if( !myInputFile )
{
	perror("File could not be opened");
}
	
char chA[14];
myInputFile.getline(chIPAddress, 14, '\n');

I need to convert to char *,
becouse of this:
sockaddr_in clientService;
clientService.sin_addr.s_addr = inet_addr( pointerA );

i try to use char chA for inet_addr(chA),
but it has error.

Please help... thanks
myName is offline   Reply With Quote
Old Mar 5th, 2006, 8:08 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I recommend you begin by reading up on pointers. There's a link in my signature to "pointer basics". While there is some equivalency between pointers and arrays, they are not precisely the same thing.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei 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 5:27 PM.

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