Thread: problem with array transport between programs

  1. #16
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by vtergolina View Post
    Yeah, it worked which means my problems are worst than i thought, thank you anyway, you dont happen know any tutorial about this kind of operation do you?
    Based on what you have demonstrated for your issues, may I suggest a refresher in C:

    Cprogramming C Tutorials
    Teach Yourself C in 21 Days
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  2. #17
    Registered User
    Join Date
    Aug 2011
    Posts
    11
    Quote Originally Posted by tabstop View Post
    You've been very careful not to even hint at what operation you are doing, so I don't know how we could possibly suggest a tutorial.
    I'm reading specters from stars wich means i need to store an X value for waveleghts and an Y value for radiation flux, the function i'm using is an older program wich get this specters and filter them in specific wavelehghts, it works fine. The new program i made, i did because i needed to automatizate the older so he can do his task with 4000 specters instead of 1 like it's original task.

    So it basicalys read the arrays X and Y of each specter and them passes one by one to the older program so he can filter it them, i wanted it to give back to the new program the awnser which is the integral of the filtred specter, the integral also was calculated on the older program.

  3. #18
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Did you actually change the code of the original, or are you trying to make "function" your filter? You'll want to make sure you are calling the original code with the data it expects (unwrapping these 4000-long arrays, etc.)

    I didn't notice before, but you wrote "Cor = ..." in your original snippet above. That's not going to get you anywhere. You only assign to individual slots of an array.

  4. #19
    Registered User
    Join Date
    Aug 2011
    Posts
    11
    I changed the code so it should be geting the arrays from the new program like it used to get from the fscanf back when it filtered one specter at time. But i don know if it is geting the arrays because i tried printing from the function and still giving me 0.0 as awnser so its probably no geting the arrays. I know the new program is reading the arrays fine because i tested it before trying to put it togheter with the new.

  5. #20
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    We don't know either because we don't have any code to work off of. Try to break this down to as simple of an implementation that you can and show us what you have.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  6. #21
    Registered User
    Join Date
    Aug 2011
    Posts
    11
    My problem is that the way i specified it on the new program aparently isnt enough to pass the arrays Sx[j] and h[j] to the older.

  7. #22
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by vtergolina View Post
    My problem is that the way i specified it on the new program aparently isnt enough to pass the arrays Sx[j] and h[j] to the older.
    Given the history up to this point, I'd say this almost certainly isn't your problem, or at least isn't your only problem. For one thing, I don't think it actually means anything.

  8. #23
    Registered User
    Join Date
    Aug 2011
    Posts
    11
    Quote Originally Posted by AndrewHunter View Post
    We don't know either because we don't have any code to work off of. Try to break this down to as simple of an implementation that you can and show us what you have.
    Ok, i have to go to class now but i'll get back here as soon as i can with a template of it.

  9. #24
    Registered User
    Join Date
    Aug 2011
    Posts
    11
    Found my error guys. the Cor parameter was giving 0.0000 because i was trying to print it as %f, changed it to %e and it gave me the right value, thanks for the help!

  10. #25
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Code:
    #define N 4000
    
    char   L[N][1000];
    signed char   x[N][1000];
    
    float Sx[N], h[N], c[N], Cor[N][4];
    Frankly I'm amazed it runs at all...
    These arrays are enormous... over 8 megs of data created on your program's stack.
    Your L array alone is 4 megs...

    Most programs only have a 1meg stack...
    You seriously need to look into using malloc() and free() to create these arrays.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Socketless Transport?
    By SMurf in forum Networking/Device Communication
    Replies: 4
    Last Post: 09-20-2010, 01:04 PM
  2. Sockets Transport Question
    By SMurf in forum Tech Board
    Replies: 0
    Last Post: 12-14-2006, 04:36 PM
  3. Problem using java programs within C code
    By lemania in forum Linux Programming
    Replies: 1
    Last Post: 05-08-2005, 02:02 AM
  4. N00bish problem: GUI programs
    By evermore96 in forum C Programming
    Replies: 2
    Last Post: 04-30-2005, 01:38 AM
  5. Replies: 3
    Last Post: 06-29-2003, 05:50 PM