Search:

Type: Posts; User: ferrad

Search: Search took 0.01 seconds.

  1. Setting up the name of a file in the executable directory

    I have to create a buffer to hold the the name of a license file which is in the executable directory. This is my klugy solution (I'm not a C programmer):


    char buffer[MAX_PATH] = "";
    ...
  2. Yes, as I created the Fortran structure as...

    Yes, as I created the Fortran structure as follows:

    type t_box
    sequence
    integer :: nvar, ncall
    real(8) :: vars(100)
    end type

    I didn't like to do this, I...
  3. Extracting an integer + real array from a pointer location

    I have a structure (void *cbdata) in memory created from Fortran. It contains:
    2 integers, then (up to) 100 doubles

    I need to extract the ints and doubles. I am doing this on the C side:


    ...
  4. Replies
    10
    Views
    263

    char declaration

    BTW why does pszMessage have to be declared as:

    char pszMessage[LS_MAX_ERROR_MESSAGE_LENGTH] = "";
    and not:

    char* pszMessage[LS_MAX_ERROR_MESSAGE_LENGTH] = "";

    The h declaration says:
    ...
  5. Replies
    10
    Views
    263

    I have, many times over my career, but I am a...

    I have, many times over my career, but I am a Fortran programmer and only have to deal with C stuff once in a blue moon. It always baffles me, so I try for myself, and then ask.
  6. Replies
    10
    Views
    263

    Just thinking do I need to append \0 to the...

    Just thinking do I need to append \0 to the string literal when calling my function?
  7. Replies
    10
    Views
    263

    Just using the same variable names and...

    Just using the same variable names and conventions as the sample code we were given with the application.
  8. Replies
    10
    Views
    263

    I guess it's just a local variable (on the...

    I guess it's just a local variable (on the stack), so gets freed automatically on return. It would different I guess if I used calloc to create the space for the Message. Then I would have to...
  9. Replies
    10
    Views
    263

    Ok great thanks. Do I not need to free the...

    Ok great thanks.
    Do I not need to free the memory for pszMessage when I leave this function? Or will it be automatically freed when exiting the function?
  10. Replies
    10
    Views
    263

    Space allocated for character string

    I have created the following function to print out an error message. The message comes back into a character string pszMessage from a call to LSgetErrorMessage.


    void printError(pLSenv pEnv,...
  11. Replies
    1
    Views
    879

    Help with deprecated functions

    I am trying to extract an environment variable and append a string to it. This is my code:

    const char* env_temp = getenv("TEMP");
    char buff[1024];
    strcpy(buff, env_temp);
    ...
  12. Replies
    6
    Views
    658

    Thanks all. I got it working: #include...

    Thanks all. I got it working:



    #include <stdlib.h>
    #include <stdio.h>


    int main(int argc, char *argv[]) {
    FILE* fp;
  13. Replies
    6
    Views
    658

    Constructing the name of a file to open

    I need to get the value of the environment variable TEMP and append the string “\test.dat” to it. Then I want to open a file with this name for writing. Then I want to write some stuff and close...
Results 1 to 13 of 13