Solved

Is there a C command  that will copy over the contents of a string starting at x pos to the end of the string??

Posted on 1998-08-10
3
211 Views
Last Modified: 2010-04-15
Or do I need to write my own. I can write my own, but it would be easier if I don't have to, you know what I am saying?  thank guys
0
Comment
Question by:kellyjj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Accepted Solution

by:
bernfarr earned 20 total points
ID: 1252020
You can use strcpy(). The trick is to figure out the arguments you pass in.

char szTarget[12] = "MyName";

   strcpy( szTarget, "YourName" );  /* Straight replacement */

   /* Change MyName to MyNumber */
   strcpy( &(szTarget[3]), "umber" );

I don't know if this is exactly what you wanted, but it may give you a place to start.
0
 
LVL 2

Author Comment

by:kellyjj
ID: 1252021
That wasn't exactly what I wanted, but your answer clicked it for me. Thanks.


0
 

Expert Comment

by:vipinjain
ID: 1252022
Hello Mr. Kellyji,

Here is another option that you can use for your need.
Ultimately You can use th STRNCPY() Function for this purpose.
e.g. : Suppose you have
 char a[]="amar nath panda";
 char b[15]; and You want to copy the string from 3rd pos. to  the end of the source string.

Sol : Use strncpy(b,3,a);
                printf("\n%s -- %s",a,b);
I think you would like it. Please send your comment at the following E-mail Address.
 amarnath_panda@wowmail.com
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question