copy string function to non const char buffer

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Im trying to copy a string to buffer for further processing. I used the instruction
<pre class="lang-c prettyprint prettyprinted" style="padding:5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; width:auto; max-height:600px <code style="margin:0px; padding:0px; border:0px; font-size:14px; vertical-align:baseline; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b char<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 *<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent buf <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent line<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 .<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent c_str<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ();[/code][/code]
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
but <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif buf[/code] type
should be <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif const
char*[/code], However If Im going to use
<pre class="lang-c prettyprint prettyprinted" style="padding:5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif; width:auto; max-height:600px <code style="margin:0px; padding:0px; border:0px; font-size:14px; vertical-align:baseline; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b const<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="kwd" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#00008b char<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 *<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent buf <span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 =<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent line<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 .<span class="pln" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent c_str<span class="pun" style="margin:0px; padding:0px; border:0px; vertical-align:baseline; background-color:transparent; color:#000000 ();[/code][/code]
<p style="padding-right:0px; font-size:14px; vertical-align:baseline; clear:both; word-wrap:break-word; font-family:Arial,Liberation Sans,DejaVu Sans,sans-serif
Ill face another problem as Im using <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif strtok_s[/code] function
for processing the <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif buf[/code].
this function expecting <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif char
*[/code] arg. rather than <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif const
char*[/code]. Is there another function or a way to copy this line to <code style="margin:0px; padding:1px 5px; border:0px; font-size:14px; vertical-align:baseline; background-color:#eeeeee; font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif char
*[/code] ??

View the full article
 
Back
Top