realloc may move the memory block to a new location, whose address is returned by the realloc function.
So you should be using the returned pointer from realloc when calling strcat.
Type: Posts; User: Scarlet7
realloc may move the memory block to a new location, whose address is returned by the realloc function.
So you should be using the returned pointer from realloc when calling strcat.
Lookup CreatFile(), ReadFile() and WriteFile(), for example:
char Data[1]; // ? a byte or what ever size you need etc...
int BytesWritten, BytesRead;
HANDLE hComPortHandle;
// To read...
The 'for' loop will loop forever, i is set to slen but not used, but then incrementing and decrementing the s pointer on each loop.
for(i = slen ; s > 0; s--)
{
s++;
}
Have a look at...
You will properly need to do something along the lines of the following skeleton code. Create the socket then pass the connection to a receiving thread to handle while the main thread listens on...
char Text[80] = {0};
char * line = "GET /send.htm?Text=START HTTP/1.1";
char *s,*t;
if(s = strchr(line, '='))
{
if(t = strchr(s, ' '))
strncpy(Text, s+1, t-s);
}
#include "switchfileio.h"
using namespace std;
The using namespace is after the included header, either place before the header include or move into the header.
Move the prototype from the header to that.c and create another in this.c with an extern.
extern void sayHello();
What reaction were you expecting, or hoping for on a left mouse button?
If to bring the NotePad to the top window the use the following:
SetForegroundWindow( hTargetWnd );
If to set...
Try using fwrite intead of fprintf:
fwrite( &patch[i], 1, 1, file);
If you have the handle to the NotePad application then try posting a WM_CHAR message, for example:
PostMessage( hTargetWnd, WM_CHAR, 'g', 0 );
It looks like you may have write the gotoxy() function your self.
Look up SetConsoleCursorPosition(), if in Windows...
The size will be more than 576kb, a float size is 4 bytes.
576kb * 4 = 2.3mb
The next pointer in head needs to be set to NULL after the first malloc:
head->next = NULL;
The call to str.c_str() is within the string "c:\\str.c_str()\document1.txt" will be treated as a string.
You need to create the string:
"c:\\" + str.c_str() + "\\document1.txt"
And also for...
Hi, Yes I known my solution is not desirable, but, I was answering the question that was being asked i.e. using a variable length array and passing arrays as function parameters, by using the example...
All that needs to be done is to allocate the array then delete when finished with, and no need for globals.
void numbers(int *array1, int arraylength){
for (int i = 0;i < arraylength;i++) {...
char s[] = "";
You've still got a problem because you're not allocating enough memory for the 's' char variable. This will only allocate 1 byte for the '\0'
Hi, I compiled with Micrsoft Visual C++ 6..
I just tried your code and got Output : [sihTsiesrever]
or like this, using pointers..
char *pi = input;
char *po = output;
do
{
if(isspace(*pi) && isspace(*(pi+1)))
You need to check for more than one space in a row and terminate the output string with '\0', that's what's causing the funny characters at the end.
while(input[i])
{
...
If test1.txt has multiple lines then the code will count the new line character '\n' or 0x10 and increment 'other_char'. You need to add some code to check for '\n' and not increment 'other_char'....
> else if (c >= 'a' && c >= 'z')
c >= 'z'
should be
c <= 'z'
In the WinApp::InitInstance() call GetCommandLine(), which returns a pointer to the command-line string for the current process. Load the file using the file name that’s contained within the 2nd set...
You're allocating memory using a local, which is allocated from the stack. When the function ends the memory on the stack is freed. So you need to allocated the memory using 'new', and when no longer...