Results 1 to 12 of 12

Thread:

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739

    "" - "broy", - "ot" . Visual Studio 2005 Express edition. , Debug , Release, retval . . , , printf- .
    , . , , , .

    Code:
    #include <stdio.h>
    #include <string.h>
    
    char *strdel(char *s, unsigned __int16 ot, unsigned __int16 broy)
    {
    char retval[1024];
    unsigned __int16 i, j;
    
     for (i=ot, j=0; i<ot+broy && i<strlen(s); i++, j++)
     retval[j]=s[i];
     
     retval[j]=0;
     
     //printf("%s",retval);
     
     return retval;
    }
    
    void main()
    {
    char s[256], p[256];
    
     strcpy_s(s, "Kondio qde spanak");
     strcpy_s(p, strdel(s, 0, 4));
    
     printf("s=%s\np=%s\n", s, p);
    }
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	New Bitmap Image.jpg‎ 
Views:	103 
Size:	16.0 KB 
ID:	15076  
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  2. #2
    Pesho's Avatar
    Join Date: Nov:2001
    Location: Sofia
    Posts: 5,169
    retval strdel. , . Debug , , retval. , .

  3. #3
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    - strcpy_s(p, strdel(s, 0, 4)):
    Code:
    strncpy(p, s+0, 4);
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  4. #4
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    , , , . - Pesho . icaci, , . , . :
    Code:
    void strdel(char *vhod, char *izhod, unsigned __int32 ot, unsigned __int32 broy)
    {
    char retval[1024];
    unsigned __int32 i, j;
    
     for (i=ot, j=0; i<ot+broy && i<strlen(vhod); i++, j++)
     retval[j]=vhod[i];
     
     retval[j++]=0;
     
     while (j--) izhod[j]=retval[j];
    }
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  5. #5
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    Quote Originally Posted by 4eRNoBiL View Post
    ...
    icaci, , ...
    , s+0 , n- , ...
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  6. #6
    Deleted User 4eRNoBiL's Avatar
    Join Date: Oct:2005
    Location:
    Posts: 739
    . , - "" , .
    Fujistu Lifebook E756 | Core i7-6500U / 400MHz-3.1GHz | 8 GB DDR4-2133 | Samsung PM871 / 256 GB SSD | 15" 1920x1080 | Manjaro Linux + kernel 4.19

  7. #7
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    , ? strncpy(), icaci?
    , , embedded . Visual Studio, .

  8. #8
    Registered User
    Join Date: Jul:2006
    Location:
    Posts: 480
    bsb, , . .
    4eRNoBiL, retval. => , . , , , strlen, , , . "" " ." " ." , .
    :
    Code:
    void COPY(char* D,char* S,int I,int N)
    {
      S+=I;
      while(N-- && *S)
        *D++=*S++;
      *D=0;
    }
    0<=I<LENGTH(S), D . , n .

  9. #9
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    djb. , ...
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  10. #10
    Registered User rldkfl's Avatar
    Join Date: Jan:2006
    Location: Sofia
    Posts: 67
    djb?
    This isn't right. It's not even wrong. -- Wolfgang Pauli

  11. #11
    philosophus duratea icaci's Avatar
    Join Date: Oct:2006
    Location: Aachen
    Posts: 2,698
    ... djb djb.
    Internet - it doesn't make you stupid, it just makes your stupidity more accessible to others

  12. #12
    Registered User rldkfl's Avatar
    Join Date: Jan:2006
    Location: Sofia
    Posts: 67
    10x
    This isn't right. It's not even wrong. -- Wolfgang Pauli

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |