Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Lite-C Legacy mode and using C functions in Pure Mode #256717
03/18/09 15:32
03/18/09 15:32

M
Malice
Unregistered
Malice
Unregistered
M



Hi I’m trying to do the beginning lessons in Sam’s Teach yourself C in 21 days using LiteC in legacy mode. I could use some help. Can you tell me why things aren’t working.

So I tried lesson 1 the Hello world program.
Sam’s has it as
Code:
  #include <stdio.h>

 main()
 {
     printf("Hello, World!")
     return 0;
 }

If I try this I get a error about the stdio.h header, so I changed it to <litec.h>, that fixes that. But when I run it again i get “main” undecleared, but I know that would happen. So I did this-
Code:
  
#include <litec.h>
int WinMain()
 {
     printf("Hello, World!")
     return 0;
 }

I saw in the legacy example that int WinMain() was used. But when I run this it compiles but does nothing. So I change it to this.
Code:
  
#include <litec.h>
void main()
 {
     printf("Hello, World!")
     return 0;
 }

This works but also opens a DX window which I don’t need and didn’t ask for. This piece of code happens to be an example in the samples folder they have it as.
Code:
  
#include <litec.h>
int WinMain()
{
	MessageBox(NULL,"Hello,World!","My first program",0);
}

But why didn’t they use printf? Messagebox is a good substitute but doesn't exactly do what printf does.I started looking at the headers (*.h) and found 3 entries for printf #1)<litec.h>(96) long printf(char*,…); #2)<stdio.h>(94) int _cdecl prinf(const char*,…); #3)<stdio.h>(243) API(printf,msvcrt)…… So I got to wounding why printf only seems to work with void main(), It’s because it’s in the litec.h as clib function internally defined in the compiler. So I’m thinking there is a step I’m missing to use it in legacy mode.. Can anyone tell me what I need to do? I ran into another function “scanf” that’s in the stdio.h like printf but returns undeclared error in the compiler. What do I need to do to use the stdio.h functions? These function must be avallible otherwise why would some one write a header including them?


EDIT* Anyone? Please?
Thanks for reading and/or replying to this post

Malice
Texas USA


Last edited by Malice; 03/18/09 17:53.
Re: Lite-C Legacy mode and using C functions in Pure Mode [Re: ] #256781
03/18/09 23:46
03/18/09 23:46

M
Malice
Unregistered
Malice
Unregistered
M



No one knows how to use the C function in the msvcr.dll. No one on this forum can help???

Re: Lite-C Legacy mode and using C functions in Pure Mode [Re: ] #256951
03/19/09 18:12
03/19/09 18:12
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Hi Malice!

Well if you don't want to open a DX Window why don't you use a normal C compiler?

greetings
KDuke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: Lite-C Legacy mode and using C functions in Pure Mode [Re: KDuke] #256955
03/19/09 18:48
03/19/09 18:48
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
printf is a DOS command, under Windows you need Messagebox. For legacy mode, you must include litec.c and use WinMain.

In pure mode, the engine accepts printf I think, but also translates it to Messagebox.

Re: Lite-C Legacy mode and using C functions in Pure Mode [Re: Tobias] #257134
03/20/09 17:37
03/20/09 17:37

M
Malice
Unregistered
Malice
Unregistered
M



Thank you both I also found out the stdio.h is not include in litec.h so you have to include it.

KDuke I am using both a normal compiler and the LC compiler to see what the different is and what LC can and can not do.Also you can kill the window in LC by setting video_mode=0, I think.

Tobis Thanks I'm reading up on the Win API to see what substitute function I should use. This teacher yourself C in 21 days is free but very old aswell.

Thank you both for replying.

Malice
Texas USA


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1