help!! out of memory

This is a discussion on help!! out of memory within the C Programming forums, part of the General Programming Boards category; Hiii, I have made a Editor which somewhat looks like the Windows Notepad using TURBO C. To store the characters ...

  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.
    Attached Files Attached Files

  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, 01:14 AM
  2. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 12:57 AM
  3. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  4. Shared Memory - shmget questions
    By hendler in forum C Programming
    Replies: 1
    Last Post: 11-29-2005, 01: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-14-2001, 11:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21