Thread: char string to long conversion

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    4

    char string to long conversion (more problems)

    Hello, I have the following question:

    I am trying to fit a long variable into char string and then convert it back to long (need this to send that string over the network)

    char cs[4];
    long lv1=12345;
    long lv2;

    memcpy(cs, &lv1, 4);
    lv2=(long)(tsC);

    printf("lv2: %lu ", lv2);

    for some reason this doesn't work

    Thanks in advance,
    Bill
    Last edited by rastan; 11-04-2003 at 07:19 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  2. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-27-2003, 12:03 AM
  3. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 01:18 AM
  4. Strings are V important...
    By NANO in forum C++ Programming
    Replies: 15
    Last Post: 04-14-2002, 11:57 AM
  5. How do you search & sort an array?
    By sketchit in forum C Programming
    Replies: 30
    Last Post: 11-03-2001, 05:26 PM