Yes I do understand the functions performed by malloc and free.Though I
use malloc(and calloc) often , I haven't worked much with free(may be because I wrote small programs ). For the allocations done in this program, i'm sending that section too.
[code=c]#include "record.h"
int main()
{
FILE * f1,*f2;
Record record,record1;
int i;
void *buff;
...
User Profile
Collapse
-
Though fread reads the written record, it only repeatedly shows the last record read , as many times as many records were written into the file.
I'm able to get all records using fscanf, but i also want to know how it could be done using fread and void pointers. So, Please tell....Leave a comment:
-
Thank you for help. I could read both using fread and fscanf in different copies of
the same proogram by allocating memory(malloc) char * fields of the struct or else by scanf/printf on each field separately .Leave a comment:
-
extracting packet info using libipq C library
I need to extract packet info (the destination address , time of arrival and destination port), for this i'm using libipq and netinet/ip.h (C libraries). The problem is that struct iphdr contains IP address while I should know the DNS name,to be required by my program to compare it with a DNS name in my program . How could this be obtained ?
Please help .(required with urgency ) -
how to read fields of a struct from file
The following code writes into the file but is unable to retrieve fields of the struct
conf_record in the printf (after fread within while loop) statement.Pleas e give a solution.
[code=c]/* record.h */
typedef struct conf_record {
char *source_IP;
char *dest_IP;
char *s_port;
char *d_port;
//char** range_allow;//[2];
char *range_disallow[2];
} Record;...Last edited by AdrianH; May 29 '07, 12:25 PM. Reason: Please use [code=c][/code] tags to improve readability. Also INDENT YOUR CODE! -
how to read a fields of a struct from file
The following code writes into the file but is unable to retrieve fields of the struct
conf_record in the printf (after fread within while loop) statement.Pleas e give a solution.
/* record.h */
typedef struct conf_record{
char * source_IP;
char * dest_IP;
char* s_port;
char* d_port;
//char** range_allow;//[2];
char* range_disallow[2];
}Record;
/*... -
error installing apache
I'm installing apache and php on a Fedora linux OS where while configuring
Apache following error occured:
configure: error: Cannot use an external APR-util with the bundled APR
Please help.
No activity results to display
Show More
Leave a comment: