Thread: Help with strncpy - crypt code

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    8

    Help with strncpy - crypt code

    Hi everybody!
    This is my first post in this forum : )
    I am newbie but with a huge interest to learn Borland C++ ( 5.5.1)

    I have a piece of code here that is burning my brain : (

    The code is simple :

    I put a word(or phrase - I do not want limitation ,but lets say here “abc” ) and my code will get each letter of this word and replace with my “Code[] array”

    So lets say that
    A=duL
    B= 1TQ
    And c = YTp

    In the end of the function , instead of I have “abc” , I will get a string with “ duL1TQ YTp”. Later ,I have the decrypt function , which is going to write back to me “abc”.
    However , I am facing 2 problems :


    a) For all word that I write, always there is some “extra ASC characters” in the begin og my string.
    For example to “abc” , I get “asc code abc” . I want just my “abc” ... : ( .
    I think this issue is on line 123 when I write “strncpy (letter, &text[c], 3); ”

    b) If I write a huge word like “amfrnbcduo;werlbnbdvgwetgfdefoerp” , it returns me just “asc code amfrnb”. Nothing else. I do not want limitation...

    Thank you everybody and I hope I can help anyone here as well

    Cheers!
    Szilvia
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strncpy
    By Poincare in forum C Programming
    Replies: 2
    Last Post: 07-15-2009, 09:13 PM
  2. Bitshift Crypt
    By ratte in forum C++ Programming
    Replies: 11
    Last Post: 01-10-2008, 02:48 PM
  3. strncpy
    By zmaker5 in forum C Programming
    Replies: 12
    Last Post: 07-28-2007, 04:15 AM
  4. CRYPT don' t save file
    By krakz in forum C Programming
    Replies: 5
    Last Post: 02-28-2003, 04:51 AM
  5. Problem with crypt
    By Unregistered in forum C Programming
    Replies: 15
    Last Post: 03-12-2002, 05:35 AM

Tags for this Thread