Sunday, April 04, 2010

TURBO C 2.0: ANSWERS TO COMMON QUESTIONS

TURBO C 2.0: ANSWERS TO COMMON QUESTIONS
----------------------------------------------------------------------
Q. How do I install Turbo C?
A. Run the INSTALL program from the INSTALL/HELP disk. To start
the installation, change your current drive to the one that
has the install program on it and type INSTALL. You will be
given instructions in a box at the bottom of the screen for
each prompt. For example, if you will be installing from
drive A:, type:

A:
INSTALL

At this point, the INSTALL program will appear with menus
selections and descriptions to guide you through the installation
process.

Q. How do I run Turbo C?
A. After you have installed Turbo C, type "TC" from the DOS
prompt and you're ready to go. Chapter 2 (Getting Started)
of the Turbo C User's Guide will guide you through your
first Turbo C program.

Q. What is the difference between TC.EXE and TCC.EXE?
A. The Turbo C package comes with two compilers, an Integrated
Environment named TC.EXE and a command-line compiler named
TCC.EXE. The Integrated Environment is essentially
the command-line compiler with an integrated editor,
linker, and debugger. Please refer to the Turbo C
User's Guide for details on using both systems.

Q. What is a configuration file?
A. A configuration file tells Turbo C what options to default to
and where to look for its library and header files. TC.EXE
looks for a configuration file named TCCONFIG.TC, and
TCC.EXE looks for a file named TURBOC.CFG. See the User's
Guide, pages 40 and 143 for more information.

Q. How do I create a configuration file?
A. When you run the INSTALL program it creates a configuration
file named TURBOC.CFG for TCC.EXE. This file is just an
ASCII file which you can change with any text editor. It
contains the path information for the library and header
files for TCC.EXE to use. The INSTALL program does not
create a TCCONFIG.TC file for TC.EXE because it installs
the directory information directly into TC.EXE. You can
create a configuration file for TC.EXE by running TC,
setting your options however you want to set them, and
typing Alt-O/S.

I n t e g r a t e d E n v i r o n m e n t
----------------------------------------------------------------------
Q. Why is Turbo C not able to find any of my #include files?
A. The compiler searches for include files in the Turbo C Include
Directories. This option is specified under the Options/Directories
menu. The INSTALL program initially sets this option to the
directory where it copied all the Turbo C *.h files.


Q. Why do I get the message:
Linker Error: Unable to open input file 'C0x.OBJ'
A. The linker searches for Turbo C start-up and library files in the
Turbo C Library Directories. This option is specified under the
Options/Directories menu. The INSTALL program initially sets this
option to a directory where it copied the start-up and library
files.


Q. How do I get Turbo C to link in my own libraries or use multiple
source files?
A. Turbo C's Project facility is designed to allow you to work with
multiple files. Refer to Chapter 3 of the Turbo C User's Guide,
under "Projects: Using Multiple Source Programs".


Q. Why does the linker tell me that all the graphics library
routines are undefined?
A. The Options/Linker/Graphics Library item must be set ON, if
you are using any Turbo C graphics functions and have not
specifyed GRAPHICS.LIB in a project file.


Q. Why does Turbo C report "Unable to open include file 'stdarg.h'"
when I try to #include ?
A. The most probable reason is that you have exceeded the number
of files that DOS can have open simultaneously. Add the line

FILES=20

to your DOS CONFIG.SYS file. This allows DOS to open up to 20
files at the same time. CONFIG.SYS will only be effective
after you have rebooted your computer. See the IBM DOS Reference
Manual for details on the CONFIG.SYS file.


Q. How do I change the colors of the editor and menus in TC?
A. The utility TCINST.EXE allows you to customize your colors.


Q. How do I get a listing of my source code to my printer?
A. From within the Turbo C editor hit

. This will
print a marked block to the printer. If no block is marked
this key sequence will print the entire file in your editor.


Q. When I Make, Run, or Trace a program Turbo C sometimes goes
through the compile and link process even when the object files
are up-to-date.
A. Turbo C's MAKE logic works solely on a file's date and time
stamp. If one of your source files is marked with a date
that's sometime in the future, the object files that are
created from it will always be older than the source file,
and Turbo C will always try to rebuild the file. You can fix
this by using TOUCH.COM to set the file to the current date
and time. You should also make sure that your system's date
and time are always properly set.


C o m m a n d - L i n e C o m p i l e r
----------------------------------------------------------------------
Q. Why is Turbo C not able to find any of my #include files?
A. The compiler searches for include files in the Turbo C Include
Directories. This option is specified by the -I switch. The INSTALL
program initially writes a configuration file (TURBOC.CFG) that
sets this to the directory where it copied all the Turbo C *.h
files.


Q. Why do I get the message:
Linker Error: Unable to open input file 'C0x.OBJ'
A. The linker searches for Turbo C start-up and library files in the
Turbo C Library Directories. This option is specified by the -L
switch. If you allow TCC to invoke the linker, it will search the
directories in the configuration file (TURBOC.CFG) written by the
INSTALL program. If you run TLINK, the configuration file is not read.

Q. Why does the linker tell me that all the graphics library
routines are undefined?
A. TCC will not search the graphics library unless you tell it to.
You should specify the graphics library on the command line. For
example, to compile BGIDEMO, type

TCC BGIDEMO.C GRAPHICS.LIB


G e n e r a l I / O
----------------------------------------------------------------------
Q. The '\n' in cprintf() does not return the cursor to the
beginning of the line. It only moves the cursor down one line.
A. cprintf() no longer interprets '\n' as a Carriage Return/
Line Feed combination. The '\n' only outputs a Line Feed. To
force the cursor to the beginning of the line, manually
insert a Carriage Return:

cprintf("\n\r");


Q. How do I print to the printer from a Turbo C program?
A. Turbo C uses a FILE pointer (stdprn) defined in the STDIO.H
file. You do not need to open stdprn before using it:

#include
main()
{
fprintf(stdprn, "Hello, world\n");
}

Note that if your printer is line-buffered, the output is
flushed only after a '\n' is sent.


Q. I am reading and writing binary files. My program is
translating the Carriage Return (0x0D) and Line Feed (0x0A)
characters. How do I prevent this from happening?
A. Files opened in text mode will translate these characters for
DOS. To read a file in binary mode, open it in binary mode.
For example

#include
main()
{
FILE *binary_fp;
char buffer[100];

binary_fp = fopen("MYFILE.BIN", "rb");

fread(buffer, sizeof(char), 100, binary_fp);

:
}

The default file mode is text.


Q. Why don't printf() and puts() print text in color?
A. Use the console I/O functions cprintf() and cputs() for color output.

#include
main()
{
textcolor(BLUE);
cprintf("I'm blue.");
}


Q. How do I print a long integer?
A. Use the "%ld" format:

long int l = 70000L;
printf("%ld", l);


Q. How do I print a long double?
A. Use the "%Lf" format.

long double ldbl = 1E500;
printf("%Lf", ldbl);


E x a m p l e P r o g r a m s
----------------------------------------------------------------------
Q. How do I compile the MICROCALC spread sheet?
A. See Appendix G of the Turbo C Reference Manual.


Q. How do I compile the BGIDEMO program?
A. 1. Make sure that the following Turbo C files are in your
current directory:

BGIDEMO.C
*.BGI
*.CHR

2. Run TC.

3. Load BGIDEMO.C into the Editor by hitting F3 then typing
BGIDEMO

3. Go to the Run menu and choose the Run item.


Q. How do I create a COM file?
A. DOS versions 3.2 and earlier include an EXE2BIN utility that
converts EXE files to COM files. For users who do not have
EXE2BIN, the Turbo C command-line linker, TLINK will create
a COM file instead of an EXE file if the /t option is
specified. For example:

tcc -mt -lt tiny

will create TINY.COM instead of TINY.EXE.

There are certain limitations in converting an EXE file to a COM
file. These limitations are documented in the IBM Disk Operating
System manual under EXE2BIN.

Turbo C's TINY model is compatible with the COM format, but programs
that use Turbo C's floating point routines cannot be converted to a
COM file.


G r a p h i c s
----------------------------------------------------------------------
Q. Why do I get the error message:

BGI Error: graphics not initialized (use 'initgraph')

when I use a graphics function? My program has already
called initgraph().
A. For some reason initgraph() failed. To find out why, check
the return value of graphresult(). For example:

#include
main()
{
int gerr; /* graphics error */
int gdriver = DETECT, gmode;

/* Initialize graphics using auto-detection and look
for the .BGI and .CHR files in the C:\TURBOC directory.
*/
initgraph(&gdriver, &gmode, "C:\\TURBOC");

if ((gerr = graphresult()) != grOk)
{
printf("Error : %s\n", grapherrormsg(gerr));
exit(1);
}

:
}


M a t h / F l o a t i n g P o i n t
----------------------------------------------------------------------
Q. Why do I get incorrect results from all the math library
functions like cos() and tan()?
A. You must #include before you call any of the standard
Turbo C math functions. In general, Turbo C assumes that a function
that is not declared returns an int. In the case of math functions,
they usually return a double. For example

/* WRONG */ /* RIGHT */
#include
main() main()
{ {
printf("%f", cos(0)); printf("%f", cos(0));
} }


Q. How do I "trap" a floating point error?
A. See the signal() and matherr() functions in the Turbo C Reference
Guide. The signal() function may be used to trap errors in the
80x87 or the 80x87 emulator. The matherr() function traps errors
in the Math Library functions.


L i n k e r E r r o r s
----------------------------------------------------------------------
Q. Why do I get the message:
Linker Error: Unable to open input file 'C0x.OBJ'
A. See "Integrated Environment" section above.


Q. Why do I get the message:
Linker Error: Undefined symbol '_main' in module C0
A. Every C program must contain a function called main(). This
is the first function executed in your program. The function
name must be all in lower case. If your program does not
have one, create one. If you are using multiple source files,
the file that contains the function main() must be one of
the files listed in the Project.

Note that an underscore character '_' is prepended to all
external Turbo C symbols.


Q. Why does the linker tell me that all the graphics library
routines are undefined?
A. See the "Integrated Environment" and "Command-line Compiler"
sections above.


Q. What is a 'Fixup overflow'?
A. See the listing of TLINK error messages in Appendix D of the
Turbo C Reference Guide.


Q. I am linking my own assembly language functions with Turbo C.
The linker reports that all of my functions are undefined.
A. Make sure that you have put an underbar character '_' in front of all
assembly language function names to be called by Turbo C. Your assembly
language program should be assembled with Case Sensitivity. See
the Chapter 12, "Advanced Programming," in the Turbo C User's Guide
for details.


O t h e r Q u e s t i o n s
----------------------------------------------------------------------
Q. How do I change the stack size?
A. The size of the stack of a Turbo C program is determined at
run-time by the global variable _stklen. To change the size
to, for example 10000 bytes, include the following line in
your program:

extern unsigned _stklen = 10000;

This statement must not be inside any function definition.
The default stack size is 4096 bytes (4K).

Q. I'm getting a 'Stack Overflow!' message when I run my program.
How can I work around this?
A. You may increase the stack size by following the procedure above. Stack
overflows are usually caused by a large amount of local data or
recursive functions. You can decrease the amount of stack space
used by declaring your local variables static:

main() main()
{ {
char x[5000]; --> static char x[5000];
: :
} }

Of course, you should be aware that there are other effects
that the "static" keyword has, as applied here.

Q. My program comes up with the message 'Null pointer assignment'
after it terminates. What does this mean?
A. Before a small-data model Turbo C program returns to DOS, it will
check to see if the beginning of its data segment has been corrupted.
This message is to warn you that you have used uninitialized pointers
or that your program has corrupted memory in some other way.

Q. Why are .EXE files generated by TC.EXE larger than those
generated by TCC.EXE?
A. In the default configuration, TC.EXE includes debugging
information in the .EXE files that it creates, and TCC.EXE
does not. If you don't want to produce this debugging
information, you can shut it off in the Integrated
Development Environment by selecting Alt-D/S/N.


Q. Why do I get "declaration syntax error" messages on DOS.H?
A. You have set the "Ansi keywords only" option ON. Keep this option
OFF when using any keywords specific to Turbo C .


Q. I have a working program that dynamically allocates memory
using malloc() or calloc() in small data models (tiny, small,
and medium). When I compile this program in large data models
(compact, large, and huge) my program hangs.
A. Make sure that you have #include in your program.


Q. I am linking my own assembly language functions with Turbo C.
But the linker reports that all of my functions are undefined.
A. See answer above in the "Linker" section.


Q. My far pointers "wrap around" when they are incremented over 64K.
How do I reference a data object that is greater than 64K?
A. Use huge pointers.


Q. Can I declare more than 64K of global variables?
A. You may have a total of up to 64K global and static data in
the Tiny, Small, Medium, Compact and Large memory models. In
the Huge model, the maximum is 64K per source module.


Q. How do I declare an array that's greater than 64K?
A. Arrays greater than 64K must be allocated off the heap. If,
for example you wanted a two-dimensional array of characters
that was 1024 by 128, the declaration you would expect to
write would be:

char array[1024][128];

But since the size of this array is greater than 64K, it must
be allocated off the heap. An example of this is:

#include

char (huge *array)[128];
:
main()
{
:
array = farcalloc(sizeof(*array), 1024);
:
}

The array can be accessed with the same code as an array not
allocated off the heap. For example:

i = array[30][56];

will assign "i" the value stored at the 31st by 57th element
in "array".

The use of the "huge" keyword is necessary in the declaration
of "array" since only a huge pointer can address objects
greater than 64k. For further discussion of huge pointers,
refer to the User's Guide.


Q. How do I interface Turbo C routines to a Turbo Pascal program?
A. See the example programs CPASDEMO.PAS and CPASDEMO.C on disk.
These files are packed in the file EXAMPLES.ARC and you will
need to UNPACK them before using them.


Q. How do I get Clipper to link with Turbo C?
A. If you are having trouble, contact Nantucket Technical Support.

Interview Preparation

The Interview
Interview is an opportunity for both the employer and the applicant to gather information. The employer wants to know if you, the applicant, have the skills, knowledge, self-confidence, and motivation necessary for the job. At this point you can be confident that the employer saw something of interest in your resume. He or she also wants to determine whether or not you will fit in with the organization's current employees and philosophy. Similarly, you will want to evaluate the position and the organization, and determine if they will fit into your career plans. The interview is a two-way exchange of information. It is an opportunity for both parties to market themselves. The employer is selling the organization to you, and you are marketing your skills, knowledge, and personality to the employer.

Interview Preparation

Research is a critical part of preparing for an interview. If you haven't done your homework, it is going to be obvious. Spend time researching and thinking about yourself, the occupation, the organization, and questions you might ask at the end of the interview.

Step 1: Know Yourself

The first step in preparing for an interview is to do a thorough self-assessment so that you will know what you have to offer an employer. It is very important to develop a complete inventory of skills, experience, and personal attributes that you can use to market yourself to employers at any time during the interview process. In developing this inventory, it is easiest to start with experience. Once you have a detailed list of activities that you have done (past jobs, extra-curricular involvements, volunteer work, school projects, etc.), it is fairly easy to identify your skills.

Simply go through the list, and for each item ask yourself "What could I have learned by doing this?" "What skills did I develop?" "What issues/circumstances have I learned to deal with?" Keep in mind that skills fall into two categories - technical and generic. Technical skills are the skills required to do a specific job. For a laboratory assistant, technical skills might include knowledge of sterilization procedures, slide preparation, and scientific report writing. For an outreach worker, technical skills might include counselling skills, case management skills, or program design and evaluation skills

Generic skills are those which are transferable to many work settings. Following is a list of the ten most marketable skills. You will notice that they are all generic.

Analytical/Problem Solving

Flexibility/Versatility

Interpersonal

Oral/Written Communication

Organization/Planning

Time Management

Motivation

Leadership

Self-Starter/Initiative

Team Player

Often when people think of skills, they tend to think of those they have developed in the workplace. However, skills are developed in a variety of settings. If you have ever researched and written a paper for a course, you probably have written communication skills. Team sports or group projects are a good way to develop the skills required of a team player and leader. Don't overlook any abilities you may have

When doing the research on yourself, identifying your experience and skills is important, but it is not all that you need to know. Consider the answers to other questions such as:

How have I demonstrated the skills required in this position?

What are my strong points and weak points?

What are my short term and long term goals?

What can I offer this particular employer?

What kind of environment do I like? (i.e. How do I like to be supervised? Do I like a fast pace?)

What do I like doing?

Apart from my skills and experience, what can I bring to this job?

Step 2: Know the Occupation

The second step in preparing for an interview is to research the occupation. This is necessary because in order to present a convincing argument that you have the experience and skills required for that occupation, you must first know what those requirements and duties are. With this information uncovered, you can then match the skills you have (using the complete skills/experience inventory you have just prepared) with the skills you know people in that occupational field need. The resulting "shortlist" will be the one that you need to emphasize during the interview.

It is also in your best interest to identify the approximate starting salary for that position, or those similar. There are several ways to find out about an occupation:

Acquire a copy of the job description from the employer (Human

Resources/Personnel) or check with Student Employment Services. If you are responding to an advertisement, this may also supply some details.

The Career Resource Centre has general information files on a variety of occupations. Make sure you have read through the appropriate file and are updated on the occupation. If you belong to a professional association related to the occupation, use its resources. These associations often publish informative newsletters and sponsor seminars. It is also a good way to meet people working in the field. Conduct information interviews with people working in the field. Read articles about people in the occupation, and articles written by people in the occupation. Sources include newspapers, magazines and the internet. Find out what the future trends are in the area. Is technology changing the job?

Step 3: Know the Organization

The more you know about an organization, the better prepared you will be to discuss how you can meet its needs. Some of the characteristics that you should know about an organization are:

Where is it located?

How big is it?

What are its products and who does it serve?

How is the organization structured?

What is its history?

Have there been any recent changes, new developments?

There are a number of ways in which you can access this information. Most medium- to large-sized organizations publish information about themselves. You can access this a number of ways:

On campus at the Student Employment Services (company literature and business directories) or at the Drake Centre Library

The Winnipeg Centennial Library has a business microfiche with information on over 5000 Canadian companies and business directories

Many companies have internet home pages which you can locate by searching by industry and company name

Finally, you can visit or phone the organization and request some information on their products, services or areas of research

If the organization is fairly small, or fairly new, there may not be much information published. In this case, it will be necessary to do an information interview. Contact someone within the organization, introduce yourself, explain that you are considering moving into the field, and ask if it would be possible to meet with him/her to inquire about the company/organization and about what exactly the position would involve.

Step 4: Prepare Questions

Having completed your background research, you are now ready to prepare questions to ask the

interviewer(s). Try to think of questions for which the answer was not readily available in company

literature. Intelligent well thought-out questions will demonstrate your genuine interest in the position. Be

careful how many questions you ask, however, as too many can imply you feel the interview was not

successfully run. Pick your questions with care - this is your chance to gather information, so ask about

what you really want to know. Avoid sounding critical by mentioning negative information you may have

discovered. This is one of the most effective ways to compare different employers, so for issues of

particular importance to you (for example, whether they support staff upgrading), you should ask the same

questions of each employer. Some sample questions are:

What are the most significant factors affecting your business today? How have changes in technology most affected your business today?

How has your business/industry been affected by the recession?

How has your company grown or changed in the last couple of years?

What future direction do you see the company taking?

Where is the greatest demand for your services or product?

Where is most of the pressure from increased business felt in this company?

Which department feels it the most?

How do you differ from your competitors?

How much responsibility will I be given in this position?

What do you like about working with this organization?

Can you tell me more about the training program?

Have any new product lines been introduced recently?

How much travel is normally expected?

What criteria will be used to evaluate my performance?

Will I work independently or as part of a team?

How did you advance to your position?

What are the career paths available in this organization?

When can I expect to hear from you regarding this position?

It is very important to ask the last question because employers want to hire individuals who are interested in the position - and asking this question definitely helps to demonstrate interest on your part. Exercise judgement when asking questions to an employer. When being interviewed by a large company that has a high profile, one would not ask the question

"What is the history of your company and how was your company started?" You can find the answer to this question in the company's annual report or articles in magazines/newspapers. However, small- and medium-sized companies do not always produce publicly available annual reports and it may be difficult to access information on the company and its role in the industry. This question is appropriate if you have exercised all other ways to find out the answer.

Etiquette that you should have


Go for a mock exercise before the real talk at the job table

Hone your interview etiquette................ Churn the right mix of deportment, attitude and dressingskills for a great job talk !

Never make the big mistake of treating an interview lightly. It's not an impromptu thing where you depend on your improvisation skills. An interview requires careful thought and planning before you take it. Keeping in mind some basic attitudes and presentation techniques will help you sail through it with panache.

So if you thought that going for an interview just meant pulling your best suit out of the wardrobe and updating your resume, please think again. You are forgetting the other essentials: body language, basic etiquette and attitude.

Remember that you are actually selling an entire package and the packaging, in this case, is as relevant as the product inside. Ultimately you are presenting yourself as a valuable professional to a new job environment. And you can't do that without minding the basic interview etiquette to get you ahead of the rest of the pack.

An interview is the sum total of many parts. It's not just what you say but how you say it that matters equally. So it's good to brush up on more than just your training skills when you do go in for an interview.

ATTIRE

How you dress for an interview is perhaps as relevant as the way you lay out your resume. Says Nina Kochar of Upgrade Management Services, an organisation which coaches' executives in the basic rules of corporate etiquette: "A person who is sloppy in appearance shows a sloppy personality, so you have to be decently dressed." Of course, decently dressed does not necessarily mean being dressed to the gills. In most cases, this would mean you would wear long sleeved shirts and a pair of formal trousers. In fact, Nina Kochar does not recommend suits, especially for younger people. "A lot of young people do not have the money to invest in suits, consequently, they wear ill-fitting or borrowed suits and that looks even worse. A tie, shirt and pant should do the trick for most junior level positions."

Most HR experts would also tell you to mind the accessories like ties, belts and shoes. To be sure, badly matched shoes and ties can have a jarring effect on an interviewer. Similarly, please avoid heavy jewellery or personal accessories as they would look incongruous on you.

ENTRANCE AND INTRODUCTION

Even though most of us are primed for the basic grilling that we would face during the interview, we seldom pay attention to the way we enter an interview room or how we introduce ourselves. Says Subhashish Mitra, deputy manager, Essar Cellphones: "A lot of people do not think it important to knock properly while entering the interview room. They assume that as an interview is taking place, the panel will be expecting them. To my mind this is a very major faux pas which really jars."

In fact, the best way to enter an interview is to knock, ask for permission to enter and then wait for a while before you actually sit down. Few interviewees know this but the interview panel needs a little quiet time to discuss the previous candidate before they get around to the next one. So your silence till you actually get seated would be very valuable. Try and keep a bag with you for all your papers and certificates; make sure this bag is an unobtrusive as possible.

ATTITUDE AND RESPONSE

This is a grey area for most interview candidates. While dressing up and resume writing are skills you can Go for a mock exercise before the real talk at the job table handle with a little practice, cultivating the right attitude as an interviewee requires a lot of patience and reading between the lines. The usual complaint of most interviewers is that few interviewees are able to stri perhaps the best thing you can do for getting your answer right. Most interviewers like to give a lead to the candidate in the way they ask the question, so it's entirely up to you to note facial expressions and the tone of the words.

Do you show your certificates immediately to the interview panel?

Not till you are asked actually. You might already have sent in your resume, so you shouldn't try and offload all your achievements and skills onto the panel till a turn in the interview leads to such a situation.

Try and take cues form the tonal variations, facial expressions and thrust of questions from the interview panel. That in itself will give you a clue as to where this interview is heading.

TEN THINGS THAT AN INTERVIEWER LOOKS IN YOU!

1. Family Background

2. Education

3. Experience

4. Stability

5. Initiative

6. General Ability

7. Interpersonal Skills

8. Confidence

9. Aptitude

10. Pleasant Looks

How one wished that an interview were a simple meeting of minds and hearts. Just one casual meeting where an employee's future gets sealed. Unfortunately, it's not something as pre-ordained as you would like it to be; it's a pre-meditated exercise which fetches you dividends only if your homework is done right.