473,320 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help req. for a header

16
I m using Turbo C......for a project(case study) i require sys/mman.h .....i have to use some functions present in it.....but it is not in my Turbo C compiler library.......where can i find this header?? which compiler??

Thanx
Oct 21 '06 #1
11 1634
Banfa
9,065 Expert Mod 8TB
That is not a standard header, you could try googling for it.
Oct 21 '06 #2
MNA
16
But I've tried googling with a lot of keywords..... I haven't had posted this simple message before googling .... Please kindly tell me where can i get these non standard headers.....

How can i do memory mapping with standard C? Well I'm trying to code a text editor and to make it work on large size files,I was thinking to memory map the files.....

Another question is that if i read the contents of a file in a buffer with fread(),will the kernel able to "swap" the parts of buffer to release some memory when another program tries to access memory?

Waiting for reply

Thanx
Oct 21 '06 #3
Banfa
9,065 Expert Mod 8TB
But I've tried googling with a lot of keywords..... I haven't had posted this simple message before googling .... Please kindly tell me where can i get these non standard headers.....
Sorry you'd be surprised how many people don't.

I found relevent information by Googling for "sys/mman.h", however I am not sure that will necessarily be the best solution for you.

How can i do memory mapping with standard C? Well I'm trying to code a text editor and to make it work on large size files,I was thinking to memory map the files.....
I think memory mapping of files is something that is provided by the Windows API if you are writing for Windows look up MapViewOfFile or start here

Another question is that if i read the contents of a file in a buffer with fread(),will the kernel able to "swap" the parts of buffer to release some memory when another program tries to access memory?
No the keneral will only be able to swop the whole buffer, it's all or nothing.

Since you are editing text files it is unlikely that the files wil be very big. I would probably not worry about just allocating a chunk of memory large enough to contain the file through normal methods.
Oct 21 '06 #4
MNA
16
I think memory mapping of files is something that is provided by the Windows API if you are writing for Windows look up MapViewOfFile or start here
okay i thought dos can also support that....don't have much knowledge of dos...just found out......

No the keneral will only be able to swop the whole buffer, it's all or nothing.

Since you are editing text files it is unlikely that the files wil be very big. I would probably not worry about just allocating a chunk of memory large enough to contain the file through normal methods.
since the kernel can swap the whole buffer..... i think i can solve the problem by multiple buffers.....one for the essential page of the file which is the present page and the rest on the other buffers,so i think the other buffers can be swapped releasing memory?? and I m programming for DOS provided with windows XP.....

yeah it is unlikely that the files will be very big but not impossible ....it can be! and i m trying to program for that possibility......

how are the text editors like EDIT , Notepad etc. coded......???just as u said???
Oct 21 '06 #5
MNA
16
Another question.....How to access the clipboard (copy/paste/cut)?

Please help me if u can
Thanx
Oct 22 '06 #6
Banfa
9,065 Expert Mod 8TB
and I m programming for DOS provided with windows XP.....

yeah it is unlikely that the files will be very big but not impossible ....it can be! and i m trying to program for that possibility......

how are the text editors like EDIT , Notepad etc. coded......???just as u said???
There is no DOS in WindowsXP. All programs, GUI and command line sit on top of the Windows Kernel. There is just a command line interface but it is not DOS and you can call MapViewOfFile from a command line program.

I know for a fact that notepad is just an edit box. The program lets the edit box handle the memory for itself, which is why it used to be limited to 16535 bytes in earlier versions of Windows.
Oct 23 '06 #7
MNA
16
Is there any way to know when some other application requires memory?? any interrupt generated or something else? I think when some program requires memory which is not available,kernel swaps the portion of memory which is not in current use.....so just as kernel gets the message,is there any way to get that message to release some memory(or specific amount of memory) ?
Oct 23 '06 #8
Banfa
9,065 Expert Mod 8TB
Why would you need to worry about this? The kernel takes care of it for you by swapping your programs memory to HD if your program is not active and another program requires physical memory.
Oct 23 '06 #9
MNA
16
Why would you need to worry about this?
Two reasons:-
I only wanted to know if it's possible.....
I don't want to jump to Visual C++,when I haven't done any extra-ordinary thing with Turbo C...... I wanted to first completely study Turbo C, then switch onto Visual C++....... Still there exists EDIT text editor which i don't think is windows console program????

Thanx
Oct 23 '06 #10
Banfa
9,065 Expert Mod 8TB
Two reasons:-
I only wanted to know if it's possible.....
I don't want to jump to Visual C++,when I haven't done any extra-ordinary thing with Turbo C...... I wanted to first completely study Turbo C, then switch onto Visual C++....... Still there exists EDIT text editor which i don't think is windows console program????

Thanx
No your program will have no knowledge of when the kernel is swapping memory to disk or who's memory is being swapped.

EDIT does still exist, and it is a 16bit (DOS or Windows 3.x) program. It runs in a virtual 16 bit machine that the WIN32 system starts when it detects a 16 bit application running.

I guess if you are using a really old version of Turbo C then you may still be using a 16 bit compiler. In this case you will be limited to 64kbyte memory blocks and i would suggest that you ungrade to a 32 bit compiler because it is much easier to manage memory using the 32 bit flat model of WIN32 than any of the WIN16/DOS models.
Oct 23 '06 #11
MNA
16
No your program will have no knowledge of when the kernel is swapping memory to disk or who's memory is being swapped.

EDIT does still exist, and it is a 16bit (DOS or Windows 3.x) program. It runs in a virtual 16 bit machine that the WIN32 system starts when it detects a 16 bit application running.

I guess if you are using a really old version of Turbo C then you may still be using a 16 bit compiler. In this case you will be limited to 64kbyte memory blocks and i would suggest that you ungrade to a 32 bit compiler because it is much easier to manage memory using the 32 bit flat model of WIN32 than any of the WIN16/DOS models.
I m using/was using Turbo C++ v3.0 .... checked the v4.5,didn't find any real difference in libraries...... Now I've downloaded the Borland 5.5 , it has libraries for memory mapping.... Thanx for the help...
Oct 26 '06 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Richard Tierney | last post by:
To create help output (the response to "myprog --help", for example) I currently create a big .h file, which includes a single string, such as: static char *help_text = "\ myprog: my program\n\...
3
by: Abhas | last post by:
> > Hi, this is Abhas, > > I had made a video library program in C++, but was facing a problem. > > After entering 12 movies, i cannot enter any more movies. > > Something gibberish comes instead....
0
by: nail | last post by:
Hi. I have this xml file: <menu> <header caption="File"> <item header="File" caption="New File"></item> <item header="File" caption="Open File"></item> <item header="File" caption="Close...
31
by: Extremest | last post by:
I have a loop that is set to run as long as the arraylist is > 0. at the beginning of this loop I grab the first object and then remove it. I then go into another loop that checks to see if there...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
0
by: magicofureyes | last post by:
Hello Guys im a just a new user and i dnt knw much abt Xml i want to upload a new template in Blogger so got some free coding but when i save this code in Blogger template it say '''' Your...
0
by: shrik | last post by:
I have following error : Total giant files in replay configuration file are : File name : /new_file/prob1.rec Given file /new_file/prob1.rec is successfully verified. Splitting for giant file...
1
by: jhaydon | last post by:
First of all, I'm not a CSS expert. If I was, I wouldn't need to be posting for help here. Secondly, I have been doing web design for several years, just not css. Thirdly, I need help and hope...
6
by: backups2007 | last post by:
Here's my code. For some reason, it's not working. Please help... Thank you. <? $so_no=$_POST; //customer type $ctype=$_POST; //customer info $cust_id=$_POST; $walkin_id=$_POST;
3
by: backups2007 | last post by:
Here'es my code. I double checked it and I can't seem to find any reason why it won't work. Or maybe I just missed something. Please help. Thanks. If you have any suggestion on how I can improve this...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.