Thread: help!! out of memory

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    11

    Angry help!! out of memory

    Hiii,

    I have made a Editor which somewhat looks like the Windows Notepad using TURBO C. To store the characters temporarily i'm using an array i.e is a Two Dimensional array ARRAY[200][55].

    If i put arrays row index value more than 200 the program is CRASHING obviously due to non availability of Memory.

    How can i avoid this BIG problem.

    PLEASE DO DOWNLOAD MY PROGRAM AND GIVE UR SUGGESTION ON THE USER INTERFACE I CREATED JUST BY USING THAT OLD <GRAPHICS.H> LIBRARY.

    Please Help!!!!.

    Thank u.

    Byeeee Denny.

  2. #2
    Registered User sean345's Avatar
    Join Date
    Mar 2002
    Posts
    346
    You can try allocating the memory at run time by using malloc. Then if there is not enough memory, malloc will return NULL and you can inform the user and close the program.

    You will have to usea char** to do what you want with malloc.

    - Sean
    If cities were built like software is built, the first woodpecker to come along would level civilization.
    Black Frog Studios

  3. #3
    Unregistered
    Guest
    Try using the Hard Disk instead. Open a temporary file and store all that is entered into the file and finally save it (if the user requires).

    -Harsha.

  4. #4
    Registered User stautze's Avatar
    Join Date
    Apr 2002
    Posts
    195
    I had to write a simple text editor for school. The idea was to use a buffer to hold a list of strings.

    Each string would hold a line of text and the buffer be a list of these lines.

    I used a double linked list for my data structure. I worked pretty good.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 01-13-2008, 02:14 AM
  2. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  3. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  4. Shared Memory - shmget questions
    By hendler in forum C Programming
    Replies: 1
    Last Post: 11-29-2005, 02:15 AM
  5. What's the best memory (RAM) type?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 12-15-2001, 12:37 AM