Warning

You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
strncpy [2019/05/23 08:32] neilsstrncpy [2020/04/14 08:58] (current) neils
Line 16: Line 16:
   rem -- the above will output "hello"   rem -- the above will output "hello"
      
-''STRNCPY'' can be used to emulate the CBM BASIC functions ''LEFT$'' and ''MID$''. The example above shows hoe to get the first n characters of a string. Here is an example for getting the middle of a string:+''STRNCPY'' can be used to emulate the CBM BASIC functions ''LEFT$'' and ''MID$''. The example above shows how to get the first n characters of a string. Here is an example for getting the middle of a string:
  
 **CBM BASIC** code: **CBM BASIC** code:
Line 29: Line 29:
   dim buffer![6]   dim buffer![6]
   b$ = @buffer!   b$ = @buffer!
-  strcpy b$, a$+4, 3+  strncpy b$, a$+4, 3
   print b$   print b$