Qbasicnews.com

Full Version: Transfering [bman.bas] to [bman.c]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is a majour project which will take time to learn (not to mention I still don't know how to install Allegro, of which I downloaded the source code. So I'm going to take it step by step. I know most of the Cyntax, but learning which functions of Qb's are which functions in C is going to be hard. I imagine there will also be times when a single function in QB will take many functions in C to do, and vice versa.

So starting off, does C handle EMS memory? Or does Allegro handle it? Or better yet, does C even require EMS memory, or does it give you plenty of conventional memory itself?

I also am gonna need to know where jofers always gets those documented functions from when he posts them here (unless you plan on posting them every time I have a question jofers Wink).
easy:

"So starting off, does C handle EMS memory?"

That question has no meaning. QB's just an implementation or dialect of a language (Basic). C is a language. "EMS" is a concept that only applies to one particular type of computer. A programming language itself doesn't have anything to do with *any specific* type of computer. The capabilities of any specific implementation of a language in regard to a specific type of computer's capabilities would depend on that specific implementation. (I can assure you, however, that there's at least one specific implementation that I'd have a hard time believing would access "EMS". It's on a couple of floppies sitting in my office--version 1 of MSFT C. Others would be the implementations of C used on SGIs and SUNs.)
C, or C++? How old is the compiler?

Your compiler probably compiles for protected mode (unless it's old), which mean you don't have to worry about conventional memory limits, EMS, or XMS.
I downloaded Dev C++ 4.
Dev C++ is a port of GNU C compiler (such as DJGPP). It operates in a flat memory model, where you can address memory using 32 bits segments, so you have access to 4 Gigs of memory directly for code and data. EMS/XMS were tricks to access more memory from real mode DOS (16 bits) environment. In a protected mode (32 bits) environment you don't need'em anymore. It uses all your base memory and if it runs out it begins with some hard disk swapping automaticly.

You'll find that this feature will make coding games in C way easier than doing the same thing in QB.
I've tried writing a test program, but it isn't working. I simply want to make the program print something, and wait until I press a key to end.

Code:
#include <stdio.h>

void main()
{
  int ch;
  puts("test");
  do {
     ch = getchar();
  } while(ch == 0);
}
Quote:I've tried writing a test program, but it isn't working. I simply want to make the program print something, and wait until I press a key to end.

Code:
#include <stdio.h>

void main()
{
  int ch;
  puts("test");
  do {
     ch = getchar();
  } while(ch == 0);
}

I think that should work:

Code:
#include <stdio.h>

void main()
{
  char ch;
  puts("test");
  do {
     ch = getchar();
  } while(ch == ' ');
}

But this is only a repaired version of yours....you have to press enter...if you want it to end by pressing any key, use this:

Code:
#include <stdio.h>
#include <stdlib.h>

void main()
{
  char ch;
  puts("test");
  system ("Pause");
}
when u init a variable in qb it it will always equal 0. not in c! so looping until ch == 0 wont happen cause it can have any value (in a very large range). I suggest you get into the habbit of giving all your new variables 0 when u init them (int ch=0Wink
Why won't this work?

Code:
#include <stdio.h>

void main()
{
  char ch;
  do {
     ch = getchar();
     printf("%s",ch);
  } while(ch !== "1");
}

I want it to print anything I type in the (1,1) coord, and I want it to stop when I press 1.
Heeehe, you're so funny seph.

Well, before asking any questions. Why don't you try actually reading a book on C coding?

%s means string, ch is just one byte.
ch is just one byte, "1" is a string.

Now go figure.