943,712 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Marked Solved
  • Views: 2167
  • C RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jul 14th, 2009
0

Re: Memory Problem After a certaion limit

Click to Expand / Collapse  Quote originally posted by Hiroshe ...
Try making a smaller example of the problems... that program looks a over complicated. If what you have work's, exept for a few errors, don't worry about changing it. Here's how I would go around doing it:
First read the description file to make a sscanf string, and make two arrays, one to hold the names of the variables, and another to hold the variables. Since the datatype can vary, maybe make the second array an array of pointers.
Next read the data file, record by record and as you index along print out the variables with there names.
Good luck.

Here the problem is not so big.Complie and run the code once.it will work fine.

and its about two functions dont go to the code now just run it and
face the problem then u will definately get sumthing.

Thanks in advance.
Reputation Points: 22
Solved Threads: 12
Junior Poster
Dream2code is offline Offline
144 posts
since Jun 2009
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

Hello Ancient Dragon,

we are operating on UNIX environment.It will be used in UNIX only.
anyways next time onwards will take care about indetation it a word.

can you please go though my problem:

1st compile and run the code as i said in #1. then while running for different files u will face the problem after the column count exceeds 10.

but why only 10???

but both the functions a running fine independently.

check it one please.
Last edited by Dream2code; Jul 14th, 2009 at 3:02 am.
Reputation Points: 22
Solved Threads: 12
Junior Poster
Dream2code is offline Offline
144 posts
since Jun 2009
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

did you try debugging using gdb?
Reputation Points: 32
Solved Threads: 14
Junior Poster
tuse is offline Offline
173 posts
since Jul 2007
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

You need to post the input data file (zip it up first!) because the program you posted produces these errors on the three example lines you posted in your post #1.
Quote ...
Dml Error: at line 1
Dml error: Missing ; at line 2
Press any key to continue . . .
Quote ...
it works upto 10 columns.

when the column name exceeds 10

it shows "segmentation fault"
>>record->column_delim=(char**)malloc(10*sizeof(char*));

That line looks awfully suspicious of the reason for your error. It is only allocating room for 10 pointers
Last edited by Ancient Dragon; Jul 14th, 2009 at 9:05 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

You need to post the input data file (zip it up first!) because the program you posted produces these errors on the three example lines you posted in your post #1.



>>record->column_delim=(char**)malloc(10*sizeof(char*));

That line looks awfully suspicious of the reason for your error. It is only allocating room for 10 pointers
i have given the dml syntax.put in mind that

format like
begin
column_1 string("|");
column_2 string("|");
....

column_n string("\n");
end;

at the End of line 2 in the dml a space is there.

"EVERY STATEMENT SHOULD END WITH A SEMICOLON EXCEPT THE BEGIN AND ENSURE THAT NO SPACE SHOULD BE THERE AFTER THE SEMICOLON"

Thats not the program error..its the error of symantic checker of my program.



record->column_delim=(char**)malloc(10*sizeof(char*));

if its the problem then we should not be able to print the informations from the description file.But we can print it.

and i changed this 10 to 1 ..5 ..20..50 ...many times.

M waiting for a miracle.lets see.its actually a strange problem.

Thanks
DP
Reputation Points: 22
Solved Threads: 12
Junior Poster
Dream2code is offline Offline
144 posts
since Jun 2009
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

Click to Expand / Collapse  Quote originally posted by tuse ...
did you try debugging using gdb?
i dont know actually how to use gdb.

please u try once from your side to debug and find the solution.

And please teach to about the usage of gdb.

Thanks,
DP
Reputation Points: 22
Solved Threads: 12
Junior Poster
Dream2code is offline Offline
144 posts
since Jun 2009
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

I'm only going to say this once more -- post the file, dummy it up with fake names if you want, but we need your file to work with. The example lines you posted in post #1 don't work
Quote ...
Deepak|23|M
puja|21|f
|XY|
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

Click to Expand / Collapse  Quote originally posted by Dream2code ...
i dont know actually how to use gdb.

please u try once from your side to debug and find the solution.

And please teach to about the usage of gdb.

Thanks,
DP
Well why don't you learn how to use gdg? Start with google.

>>please u try once from your side to debug and find the solution.
DaniWeb is not your a debugger.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

description file:
=================

begin
name string("|");
age string("|");
a string("|");
a string("|");
a string("|");
a string("|");
a string("|");
a string("|");
a string("|");
a string("|");
sex string("\n");
end;

data file:
============

x|y|x|a|b|c|d|d|d|a|a|d
x|y|x|a|b|c|d|d|d|a|a|d
x|y|x|a|b|c|d|d|d|a|a|d
x|y|x|a|b|c|d|d|d|a|a|d


anyways u can create any kind of file as per the description file syntax and after that
create any data file as per the description file.

In my post#1 every thing described properly.
In fact it a realtime utility to be used in the server.
Reputation Points: 22
Solved Threads: 12
Junior Poster
Dream2code is offline Offline
144 posts
since Jun 2009
Jul 14th, 2009
0

Re: Memory Problem After a certain limit

Well why don't you learn how to use gdg? Start with google.

>>please u try once from your side to debug and find the solution.
DaniWeb is not your a debugger.
i am ready to learn and take the tips all time.will learn gdb soon.
anyways now i am concentraing on this problem.

Thanks for your advice.
Reputation Points: 22
Solved Threads: 12
Junior Poster
Dream2code is offline Offline
144 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: Finding the number of variables equal to a certain value
Next Thread in C Forum Timeline: falling letters





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC