User Profile

Collapse

Profile Sidebar

Collapse
arnaudk
arnaudk
Last Activity: Sep 2 '21, 12:21 AM
Joined: Sep 3 '07
Location: The Netherlands
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • If you're not using wide chars then the easiest thing is not compile with unicode. Hit Alt-F7 in your project and under "Configurat ion Properties" change "Character Set" from Unicode to Multi-Byte.
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Passing char[][] as argument
    in C
    Ah, OK, I see your point.
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Passing char[][] as argument
    in C
    Casting still silently takes place here since malloc always returns void*. Writing (char**) makes it more explicit but is indeed not required; some compilers may warn that implicit casting is taking place if on a 'paranoid' warning level, although probably not when casting from void, come to think of it.Right, assuming krreks wants to store num strings, each of length maxLen+1, then he'll need num pointers to char[maxLen+1] arrays;
    Code:
    char (*array)[num]
    ...
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Passing char[][] as argument
    in C
    But one of those is wrong. You'll probably save yourself some time if you read that article on arrays mentioned above. The correct form should be
    char ** arr = (char **) malloc(num*(max Len+1)); now you have an array big enough to hold num strings of maxLen characters (plus '\0'), and drop the malloc() on line 6....
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Passing char[][] as argument
    in C
    Check your types: is (char *) malloc(num) of type char** on line 2? Did you try to compile this code?
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to to pass in a unknown data and retrieving it
    in C
    *SLAP*!
    Oops, message too short... *SLAP* *SLAP* *SLAP* ;-)
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Passing char[][] as argument
    in C
    if(fillFileArr( &(files[0][0]), &(buf[0]), num)==-1) is wrong: is &(files[0][0]) of type char ** ? I suggest you read this.
    EDIT: Oops, Banfa was faster.
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Clearing a char pointer
    in C
    You have to initialize your buffer. You allocated memory for it alright but that memory can contain any junk, including what happened to be there before. free() releases the memory but doesn't wipe the buffer either.

    You can initialize your buffer, setting all bits to zero, by using calloc() instead of malloc(). Either use that together with free() to reallocate a clean buffer each time, or just overwrite the buffer's contents with...
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to String manipulation question
    in C
    You're not looking for sprintf(), are you?
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to sscanf print format problem - %hhd
    in C
    Yes, I agree it does sound a bit fishy... That's why I'd like to see some code.
    See more | Go to post

    Leave a comment:


  • I did a little searching on the details how how HDDs demagnetize. From what I can ascertain, it looks like it would take about 22 years (details below) for you to loose your data due to thermally-driven demagnetization if the hard drive were just sitting motionless at room temperature in a dark corner. In reality, this time will be a bit shorter because of mechanical vibrations and external magnetic fields arising due to everything from the motor...
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to sscanf print format problem - %hhd
    in C
    Jos, I thought you had gotten a faster keyboard! Maybe it needs some lubrication... ;-)
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to sscanf print format problem - %hhd
    in C
    Are you using switch statements? Note then that all cases should be unique - maybe the result of the scanf is causing two cases to be the same. Perhaps you could give us an example of a line where this error occurs.
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to change shared lib to exe
    in C
    Is this related to your previous problem? Did you fix that?
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Locking host file
    I don't think editing the hosts file is the way to go.
    As you pointed out, the host file is accessed and written to by other programs, so locking it is not a good idea. Even if you could, there are many workarounds. For example, the user can easily get the ip address of the webserver to access it; typing 74.125.79.103 will take you to www.google.com even if that's blocked in the host file.
    There is lots of parental control software...
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to Using clrscr() without conio.h header file
    in C
    Including the header file is not the issue. Read post #5 carefully. So long as the required library is linked then the code will work in principle, although this is a really sloppy way of doing things.
    If you turn more compiler warnings, your compiler will probably warn you that you are using a function without declaring it which is bad practice.

    Aside from this, it's possible that the conio.h header is included anyway by some...
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to How to run an existing DLL?
    in C
    Ah well there's your problem, then. You need to know what a DLL is. Google will provide many answers, as will MSDN.
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to sscanf print format problem - %hhd
    in C
    I can see three scenarios,
    1. You're scanning a string for a character. You use %c in the format specifier and provide a short int.
      Then character will be silently cast to a short int. The short int you provided will be assigned the ASCII value of the character, as expected.

    2. You're scanning a string for a non-numeric character. You use %hhd in the format specifier and provide a short int.
      Probably %hhd is interpreted
    ...
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to How to run an existing DLL?
    in C
    If you know what's in the DLL, then write a program that includes the appropriate header and calls the routines defined in the header to test them. Then compile your program linking it to the DLL and ensure the routines behave as expected.
    See more | Go to post

    Leave a comment:


  • arnaudk
    replied to How to run an existing DLL?
    in C
    In order to test your dlls you should know what they do and what their routines are called. Do you?
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...