User Profile
Collapse
-
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. -
-
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]
Leave a comment:
-
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....Leave a comment:
-
Check your types: is (char *) malloc(num) of type char** on line 2? Did you try to compile this code?Leave a comment:
-
-
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.Leave a comment:
-
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...Leave a comment:
-
-
Yes, I agree it does sound a bit fishy... That's why I'd like to see some code.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...Leave a comment:
-
Jos, I thought you had gotten a faster keyboard! Maybe it needs some lubrication... ;-)Leave a comment:
-
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.Leave a comment:
-
-
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...Leave a comment:
-
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...Leave a comment:
-
Ah well there's your problem, then. You need to know what a DLL is. Google will provide many answers, as will MSDN.Leave a comment:
-
I can see three scenarios,- 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.
- 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
Leave a comment:
- You're scanning a string for a character. You use %c in the format specifier and provide a short int.
-
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.Leave a comment:
-
In order to test your dlls you should know what they do and what their routines are called. Do you?Leave a comment:
No activity results to display
Show More
Leave a comment: