|
Davitor wrote: Access vilolation reading location 0xfeeefeee
0xfeeefeee is a Magic Number[^] which has a meaning. This essentially means that you are trying to access memory AFTER it has been freed. You should begin debugging by checking the variables that you are accessing in your worker thread.
Best Wishes,
-David Delaune
|
|
|
|
|
Google is your friend: try this[^].
Steve
|
|
|
|
|
Anyone can tell me How to remove segmentation fault from these program
#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main()
{
char *buf;
int nread;
nread=read(0,&buf,strlen(buf)); // in these statement i am getting segmentation fault
printf("buffer size is %d\n",nread);
if(nread == -1)
{
write(2,"An error occured in read function\n",27);
}
else
{
if(nread==0)
write(2,"Data is not written to the filedescriptor\n",27);
else
write(2,"Everything went smoothly it has read the bytes\n",27);
}
}
output
sandeep@sandeep $ ./a.out <x
buffer size is 62
Everything went smoothly itSegmentation fault
|
|
|
|
|
Try:
#include<stdio.h>
#include<unistd.h>
#include<string.h>
int main()
{
char buf[128];
int nread;
nread = read(0, buf, sizeof(buf));
printf("buffer size is %d\n", nread);
...
}
|
|
|
|
|
firstly thanks
the above will work, but why not the code what i wrote,whats wrong with my code
|
|
|
|
|
sandeep_dhruwa wrote: the above will work, but why not the code what i wrote,whats wrong with my code
Are you unable to see the difference between char *buf and char buf[128] ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
You should allocate memory for you buffer and call correctly the function.
For instance:
char buf[0x100];
int nread;
nread = _read( stdin, buf, sizeof(buf));
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
thanks
the above may work with memset()
thank you
|
|
|
|
|
You don't need memset , you must allocate memory for the buffer (you didn't), either onto the stack (as I did) or in the heap via, for instance, malloc .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Your buf variable is an uninitialized pointer, it will surely segfault when you pass it to strlen. I also suspect that read won't work the way you think it will work, but that's just a guess right now...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I want ot kwn more about multiple mark in-out design means the implementation structure. Please help me
|
|
|
|
|
ZMA_BUNTS wrote: multiple mark in-out design means the implementation structure
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Needing facts and all that...
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I suppose I should switch from Sherlock Charles to Dr.Charles Hesselius [^]...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ZMA_BUNTS wrote: I want ot kwn more about multiple mark in-out design means the implementation structure. Please help me
The answer is: Liquid Nitrogen[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
I mean - you cannot possibly answer that question otherwise. Therefore two words. Liquid Nitrogen.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: you cannot possibly answer that question otherwise.
Even Carlo ?
|
|
|
|
|
With the exception of Carlo, of course!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Have ten cool points
|
|
|
|
|
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
i want to sign some piece of data using a certificate's private key. anyone know how and what do i call from capicom functions to encrypt using private key? thanks in advance
|
|
|
|
|
|
nice thanks. i'll look into this cryptimportkey() function, although the example doesn't run for me (using visual studio 2005)....
|
|
|
|
|
Yes correct, it's working for VS2008.
|
|
|
|