Thread: TurboC returns malloc() NULL

  1. #1
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158

    TurboC returns malloc() NULL

    When I try to call malloc() or farmalloc() from a program I compiled in TurboC, it always returns NULL. What's the deal here?

    It's not like I don't have room in my memory for 5 bytes.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Can you post a minimal code snippet that demonstrates the issue? It may also behoove you to mention OS.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    This is the third post from you about DOS programming and extremely old compilers. Why are you doing this? Turbo C is extremely outdated.

  4. #4
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    Ah, nevermind I have it working now. I have no idea what I did to make it work, but it just is.

    @Bubba, I was trying to make somthing for an old computer, but I've given up on it now, my idea was bad, so I don't care to share.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I have no idea what I did to make it work, but it just is.
    Your re-arrangement of the deck chairs has temporarily stopped the titanic from sinking.

    In other words, the problem is still there, but through random tinkering, you've managed to cover up the problem for the moment.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    2,158
    >> In other words, the problem is still there, but through random tinkering, you've managed to cover up the problem for the moment.

    Most likely the case.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked List Not Saving Value as Int
    By bar338 in forum C Programming
    Replies: 4
    Last Post: 05-04-2009, 07:53 PM
  2. addrinfo Structure Not Working
    By pobri19 in forum Networking/Device Communication
    Replies: 9
    Last Post: 10-22-2008, 10:07 AM
  3. Problem with a menu.
    By Rare177 in forum Windows Programming
    Replies: 4
    Last Post: 09-07-2004, 11:51 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. opengl program as win API menu item
    By SAMSAM in forum Game Programming
    Replies: 1
    Last Post: 03-03-2003, 07:48 PM