Search:

Type: Posts; User: laserlight

Page 1 of 20 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    1
    Views
    67

    Read this website's tutorial on command line...

    Read this website's tutorial on command line arguments.
  2. Replies
    1
    Views
    69

    Is this binary file in a pre-defined format, or...

    Is this binary file in a pre-defined format, or do you have control over the whole process, i.e., you just want a portable way to write to a file in a binary format that you can read from?

    If it...
  3. Are you basically implementing a semaphore?

    Are you basically implementing a semaphore?
  4. Yes, like this: std::string...

    Yes, like this:

    std::string format_time(std::time_t time_value)
    {
    std::string result(20, '\0');
    std::strftime(&result[0], result.size(), "%d/%m/%Y %T", std::localtime(&time_value));
    ...
  5. There are two problems with your code: The...

    There are two problems with your code:

    The std::string is empty.
    You're calling c_str(), which returns a const char*, and then casting away the constness, which could be problematic if the...
  6. Replies
    14
    Views
    249

    That's what I mean by "Either that, or you reuse...

    That's what I mean by "Either that, or you reuse a suitable member, but that's code obfuscation."

    Basically, instead of properly designing a way to convey the number of items, you're obfuscating...
  7. Replies
    14
    Views
    175

    From what I see, you want to parse that line of...

    From what I see, you want to parse that line of input separated by semi-colons into the nodes of a linked list.

    If you find this difficult to understand, then take a step back and imagine you had...
  8. Replies
    14
    Views
    175

    Post code. Actually, let's make this a rule:...

    Post code. Actually, let's make this a rule: whenever you ask a question that has to do with some code concept, post relevant code to go along with it.
  9. Replies
    14
    Views
    175

    What do you mean by the "self-reference part"? A...

    What do you mean by the "self-reference part"? A code snippet might help.
  10. Replies
    14
    Views
    175

    Are you talking about a node in a linked list? If...

    Are you talking about a node in a linked list? If so, the pointer to a node that is a member of the node struct is not a "self-reference"; it is a pointer to the next node in the linked list.
  11. Replies
    14
    Views
    249

    That's not a good idea: it means that you need a...

    That's not a good idea: it means that you need a member in the struct object just for storing the number of items, and this member is uselessly repeated for all the struct objects even though most of...
  12. Replies
    2
    Views
    120

    For out of bounds checking you would compile...

    For out of bounds checking you would compile without defining NDEBUG and enable options like checked iterators, as well as placing your own pre-condition/post-condition assertions.
  13. Thread: Struct.

    by laserlight
    Replies
    11
    Views
    142

    Your question does not make sense. Perhaps you...

    Your question does not make sense. Perhaps you should write a test program to illustrate the options you're considering.
  14. Replies
    1
    Views
    233

    As you say, this is for fun, so you don't have to...

    As you say, this is for fun, so you don't have to take it so seriously, hence you just need to make it recognisably C. For example:

    struct baby *expecting(void) {
    delay(23587200);
    size_t...
  15. Replies
    2
    Views
    124

    Get rid of this: token = (char*) malloc...

    Get rid of this:

    token = (char*) malloc (sizeof (50));
    You don't need to malloc as token will be pointing to what strtok returns.

    This:

    if ( argc == 2 ) {
    strcpy(myfile, argv[1]);
    }
  16. Replies
    6
    Views
    164

    The term is "member" not "call". Anyway, have...

    The term is "member" not "call".

    Anyway, have you successfully done this with nodes containing one such member?
  17. Replies
    2
    Views
    106

    Put aside this program and instead write a...

    Put aside this program and instead write a program that prints "yes" if the number input is a palindrome number and "no" otherwise. Show us this program.

    The idea is that first you need confidence...
  18. When you start getting worried about "mixing...

    When you start getting worried about "mixing variables", it means that it is time to break your function into smaller functions that each does one thing and does it well.


    Then don't assume....
  19. Are you sure velocidad_media is working correctly...

    Are you sure velocidad_media is working correctly with the input from fgets? Recall that fgets stores the newline from reading the line at the end of the string if there is space for it.
    ...
  20. Replies
    5
    Views
    130

    You declared struct mme_ue_t, so you can only use...

    You declared struct mme_ue_t, so you can only use struct mme_ue_t, not mme_ue_t. You need a typedef to use mme_ue_t.
  21. Replies
    5
    Views
    130

    Why don't you write a tiny example program and...

    Why don't you write a tiny example program and try to compile it?
  22. Replies
    5
    Views
    130

    It is a declaration of a function named...

    It is a declaration of a function named sgsap_build that takes a pointer to mme_ue_t as an argument and returns a pointer to X.

    Note that you should have a typedef of struct mme_ue_t to mme_ue_t.
  23. Replies
    3
    Views
    140

    I'd say that it makes more sense to #define...

    I'd say that it makes more sense to #define DIRECTORY to be a string literal instead of a token that you then stringify: that way, if you want to say print DIRECTORY for some reason, you just do it....
  24. Replies
    7
    Views
    242

    Ah, now that's different. If hello is a...

    Ah, now that's different. If hello is a parameter, then you do need it to be a pointer to a pointer even when allocating for a dynamic array of codification objects because you want the pointer from...
  25. Replies
    2
    Views
    134

    You forgot to allocate space for the dynamic...

    You forgot to allocate space for the dynamic array, say by calling malloc.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4