Search:

Type: Posts; User: miclus

Search: Search took 0.01 seconds.

  1. Replies
    7
    Views
    5,184

    Well, let me back up then. I might not be...

    Well, let me back up then. I might not be understanding how the flags work. For instance, I was thinking this code would print 123 in hex format:



    #include <iostream>
    #include <iomanip>
    ...
  2. Replies
    7
    Views
    5,184

    Thanks. I forgot to mention that I'll be...

    Thanks. I forgot to mention that I'll be printing unsigned long values, so I can't use a string of characters.
  3. Replies
    7
    Views
    5,184

    Thanks for replying. I can get it working like...

    Thanks for replying. I can get it working like that, but I can't get it to set the stream like that and pass it off to a function.
  4. Replies
    7
    Views
    5,184

    Printing numbers in hex format

    I need to pass the std::cout to a function so that numbers print in hex and uppercase and 8 digits are printed with 0 fill. I got it to print in hex and uppercase, but I can't figure out the 0 fill....
  5. Replies
    11
    Views
    3,376

    Calling exit() with dynamic memory

    Is it wrong to call exit(1) when a failed memory request happens since there may be dynamically allocated memory that exists elsewhere in the program that won't get freed?
  6. Replies
    7
    Views
    3,589

    Thanks for the replies. After testing, I see...

    Thanks for the replies. After testing, I see that not freeing the variable creates a memory leak. I call the test function in a loop and it eventually gives me a memory error, I suspect since I'm...
  7. Replies
    7
    Views
    3,589

    Also, if I get rid of this line only: dirPtr =...

    Also, if I get rid of this line only:

    dirPtr = (char *)malloc(5);

    It seems to work out fine.
  8. Replies
    7
    Views
    3,589

    Interesting. I have read other places that a...

    Interesting. I have read other places that a copy is made so it's ok. I'm only an average programmer. So, I always clean up any dynamically allocated memory I create. So, I guess this is ok not...
  9. Replies
    7
    Views
    3,589

    Environment variable corruption

    Hi, someone suggested I post this here. I'm writing a shell and my environment variables seem to get corrupted for strange reasons. Here is one example of code. The correlation seems to be with...
  10. Hmm, can you try this Nessarose? int main() {...

    Hmm, can you try this Nessarose?

    int main()
    {

    char *dirPtr;

    char *path;
    path = (char *)malloc(12);
  11. getcwd() function messes up my environment variable

    Hi, I'm creating a shell and when I call the getcwd() function, it makes any environment variables I defined go away. Here is an example:

    int main()
    {

    char dir[500];
    ...
  12. Replies
    6
    Views
    2,680

    Passing a 2d Array of pointers to a Function

    Hi, I have this array of pointers:

    char *test[50];

    I want to be able to pass it to a function without the function being able to change anything in the array. Any ideas?
  13. Replies
    9
    Views
    1,568

    Hi, thanks for the help. I think I found the...

    Hi, thanks for the help. I think I found the problem. I had

    args[argnum] = new char[sizeof(superbuffer) + 1];

    I think I meant strlen(superbuffer).
  14. Replies
    9
    Views
    1,568

    Problem with this code

    Hi, can anyone explain why this crashes at the delete part?

    char *args[1000];

    args[0] = new char[10];

    delete [] args[0];

    Thanks.
  15. Thread: Date Function

    by miclus
    Replies
    2
    Views
    1,934

    Works great. Thanks.

    Works great. Thanks.
  16. Thread: Date Function

    by miclus
    Replies
    2
    Views
    1,934

    Date Function

    Hi, I was wondering if there is a simple way to get the current date in C?
  17. Replies
    7
    Views
    1,989

    Wow, thanks, it brought my file down to 43kb! ...

    Wow, thanks, it brought my file down to 43kb! Thanks!
  18. Replies
    7
    Views
    1,989

    No, but I did now and it fixed it. But, not the...

    No, but I did now and it fixed it. But, not the other error:

    error: `chdir' undeclared (first use this function)
  19. Replies
    7
    Views
    1,989

    Thanks for the reply. I get 2 errors though,...

    Thanks for the reply. I get 2 errors though, trying to compile with this. They are both similar so I'll only list one:

    recorder.cpp:107: error: `mkdir' undeclared (first use this function)

    It...
  20. Replies
    7
    Views
    1,989

    Good dos compiler

    Hi, I am looking for a compiler that creates a dos executable and can make it real small. I have a bit of code I wrote that is about 5kb and when I compile it in Visual C++ I get an exe file size of...
  21. Thread: Atomic Types

    by miclus
    Replies
    4
    Views
    2,009

    Yeah, I mean the built-in keyword types where you...

    Yeah, I mean the built-in keyword types where you put "int" or "char" for instance. Thanks for the replies.
  22. Thread: Atomic Types

    by miclus
    Replies
    4
    Views
    2,009

    Atomic Types

    Hi, I was wondering if the atomic types in C++ have constructors and destructors?
Results 1 to 22 of 22