Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-20-2011, 06:10 PM   #1
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Rep: Reputation: 69
I got a question about inserting char arrays into a string...

For example say I have the following code in C.
char user[32] = "william";
execlp("echo", "echo", "Hello user", NULL);
How would I have william be inserted into user on the execlp line?

Last edited by trist007; 04-20-2011 at 06:14 PM.
Old 04-20-2011, 06:21 PM   #2
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Ah I got it, just inserted it as another argument.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Why is char* a string and not a pointer to a char? el_b Programming 2 09-25-2009 10:33 AM
assigning char arrays calorie712 Programming 3 05-02-2006 12:24 PM
C++ Return Char Arrays (not with pointers) sadarax Programming 4 02-03-2006 04:49 PM
Help needed using char arrays, %s, and if() in C KneeLess Programming 5 08-13-2003 08:42 PM
Comparing Char arrays n_ick2000 Programming 5 02-25-2003 09:02 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration