Hi.
I was reading some articles about static and dynamic memory allocation and there is something I don`t understand.
As I read, in assembly is it possible to extend the space used on the...
Type: Posts; User: raczzoli
Hi.
I was reading some articles about static and dynamic memory allocation and there is something I don`t understand.
As I read, in assembly is it possible to extend the space used on the...
Thank you very much for your help.
Hi.
I started to read some documentations and tutorials about file system implementations, and there is something I don`t understand. How superblock, inode table, bitmaps etc are read from the...
Hi.
I started to read some documentations and tutorials about file system implementations, and there is something I don`t understand. How superblock, inode table, bitmaps etc are read from the...
Hi.
I need to parse a header read from a socket, which has the following structure.
Bit 1. indicating if this is the final fragment of a message
Bit 2,3,4. is 0
Bit 5,6,7,8. is an opcode,...
I didn`t say I like object oriented languages, I only said that I used some of them at work. In fact I don`t care if it`s oo, procedural, structural or anything else, as long as the code is clean,...
You can use getchar() at the end of your main function.
Hi. I`ve written some smaller projects in C, like programs which were listening on a specified port, and parsed coordinates coming from a gps device, or mini chat servers, so I know how to do some...
Hi.
I have the following code:
char file_path[256];
...
handle = dlopen(file_path, RTLD_LAZY);
...
I just changed the module = malloc(sizeof(module_t *)) to module = malloc( sizeof(*module) ); like you said, and the errors I`ve been having just gone away.
Thank you very much for your help.
I ran my program through valgrind, and saw the errors about the memory corruption. I`ve also corrected some other errors too, but there are two more errors left, and I can`t figure out what am I...
I didn`t want to leave the malloc(1) in my code, just wanted to see what happens, and when I saw that it still works, I didn`t understand why. I will run my application through valgrind, just out of...
Thank you.
I just added the following lines to my code.
#define MODULES_PREFIX "mod_"
typedef struct
{
char *name;
void *handle; //the handler returned by dlopen
I wanted to limit the use of mallocs, to save some execution time, but in this case I guess it is too a solution. Thank you for your reply.
Thank you all for the quick replies. They helped me a lot.
Hi. I have the following function which in the future will load all of the .so modules in a given directory with dlopen, for the moment it only lists the sub directories within "MODULES_PATH", and...
I finally solved it. I changed the media_t structure so all the members are statically allocated. Now it looks like this:
typedef struct
{
char title[128];
char artist[128];
char...
This way it works, so the problem is somewhere else in my application. Thanks for your help, and I will let you know if I solved it, and how.
Hi, and thanks for the reply.
I changed the code, so now it looks like this;
media->title = malloc(31); memset(media->title, 0, 31);
media->artist = malloc(31); memset(media->artist, 0,...
I have a function which reads headers from mp3 files, and extracts the title, artist, album etc. The code looks like this:
typedef struct
{
char *title;
char *artist;
char *album;
}...
Thank you.
Hi.
I have the following code in my application:
#define PORT 1234
#define HOST "http://example.com:1234"
Thank you very much for the replies.
Now I understand the role of these kinds of attributes.
Have a good day.
Hi. I was browsing through the php source code, and I found the following function prototype.
PHPAPI char *php_strtoupper(char *s, size_t len);
I saw this kind of declaration in many source...