Ok, so cast is unnecessary
However, if you do a google search for 'malloc', (almost) every code usage sample uses casting, as does my K&R C book.
It is only if you search for 'cast malloc' you find how to really use malloc.
Thanks to Salem for spotting the original error
SD
Salem - i agree about the byte rather than pointer allocation.
As for casting - I was under the impression that casting is required to ensure the return a pointer of the correct type (for pointer arithmatic), and it is best practice to cast.
SD
Hi,
I have a dynamic array which i need to find the size of to re-allocate more space to:
char **dynamic_array;
char *ptr;
ptr=(char *)malloc(10);
memcpy(ptr,"something\0",10);
dynamic_array=(char **)malloc(1);
dynamic_array[0]=ptr;
ptr=(char *)malloc(10);
memcpy(ptr,"nothing \0",10)...
Thanks for the replys.
Seaspray0:
IP has been configured. I have shared folder on remote machine (everyone and guest - all ticked,security .
The problem is that the office machine does not prompt with login box or anything - you just get the error.
Mark:
Novel idea, but no good. Machine has to...
To bypass the login screen and automatically login in as the administrator, you need to run regedit and make the following resistry mods:
Find key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Ensure the following properties are set (adding them if necessary)...
I have a server which normally resides in an office on a domain.
I have a remote location with a server which does not belong to a domain.
I physically take the office server to the remote location to run a job, which involves copying files from the office server to the other server. The 2...
I have a server which normally resides in an office on a domain.
I have a remote location with a server which does not belong to a domain.
I physically take the office server to the remote location to run a job, which involves copying files from the office server to the other server. The 2...
I need to copy files from one place to another, and will do it every 60 seconds. As this is external, i can not get an event.
So to use the timer, my copy code would need to be called from the timer event function?
SD
Hi,
I have written the following ugly function. This appears to hog all processor power, so there must be a better way to sleep in a program for a period of time.
Does anyone have any suggestions?
// Will sleep the program for given number of seconds
private void Sleep(int i_SleepSeconds)
{...
Found a way of doing it
string s_conn="[connection string]";
SqlConnection oConn = new SqlConnection(s_conn);
oConn.Open ();
SqlCommand oCmd;
oCmd = new SqlCommand ("INSERT into Names(Title,Name) VALUES ('Mr','Bloggs')");
oCmd.Connection=oConn;
int...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.