Converting an array to a string

Discussion in 'Programmer's Corner' started by Jorgy, Nov 23, 2009.

  1. Jorgy

    Thread Starter New Member

    Oct 10, 2009
    Hello Everyone,

    I have an array in my C code that consists of 50000 samples of positive and negative digits. Is there anyway I can turn this array into a string?
  2. KL7AJ

    AAC Fanatic!

    Nov 4, 2008

    Hmmm....well if this was Labview, I'd just wire up a "convert array to string" vi. Guess that's not what you're looking for, though. :0

    If you're trying to do this in C, the fscanf is the function you want. This will scan a string (or array) of ny dimension, and format it into any array you want.

    Eric the Helpful
    Last edited: Nov 23, 2009
  3. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    In straight C a string is an array. (Actually even in C++).

    Are you using C or C++?

    What kind of "digits" are they? Integer? Floats? Char?

    Do you want each number it it's own string, an array of strings or all of the numbers in one string?

    If you can define exactly what you are trying to do, I may be able to help a big more.
    Last edited: Nov 23, 2009