Is necessary to use conio.h in c? [closed] - c

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed last year.
Improve this question
I'm a beginner in coding and I was practicing coding. I wanted to know that is it necessary to use conio.h in C Programming. Because I was able to run my program without using conio.h.

Is necessary to use conio.h in c?
If you don't use any declaration from a header, then you don't need to include it. There's nothing in the conio.h header that must be used to write a C program in general.
In fact, conio.h is a non-standard platform specific header on an ancient and obsolete operating system and shouldn't be used at all if your goal is to write modern cross platform programs - which is a reasonable goal to have.

Related

How does C access files? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
everyone! I'm learning how to access files in C but, I wonder how my program(or C) access files(drive sectors)? I'm searching the Internet for answers but they don't have some proper explanation on how C(or my program), loads drive sectors to memory. Please give me some clarity, and thanks in advance.
C programs use functions of the kernel or a device driver to access hardware. A computing platform (Windows, Linux, OSX, etc) that supports C provides an implementation of the C standard library for programmers. This library contains system specific implementations of functions for accessing files, like fopen. The systems implementation of the standard library is most often just a wrapper around their specific system calls. For example on Windows, the C standard library is going to end up calling these functions: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/

In a C program, what exactly happens under the hood if I call a function from a header file from /usr/include? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
The header files of C library functions can be found under /usr/include. The actual source files, however, don't seem to be simply located anywhere in the file system.
So what exactly happens under the hood if I call a function from a header file from /usr/include in my C program?
The implementation of the C library is typically stored on the system as a shared library which typically has a .so extension. These libraries typically live in /usr/lib, although they can reside in other locations based on the system.
When your program is compiled and linked, it is automatically linked to the C standard library. Then when it runs, it loads the shared libraries that are linked with it.

Error Illegal character(0x1) in compile [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am trying to compile c code in c++ and I get this error!
Illegal character(0x1)، Why this error occurred?
May be you have copied the code from the Internet!
Try typing it.
It will improve your coding ability.
Probably there really is a funny character in your file, maybe one your editor doesn't render.
Try using a hex dump program to see each byte of the file rather than an editor. You may find that there's more characters than you realize in your file.
When I started to learn C ( with an old borland in the late 90s ) I wish somebody would have told me this advice: don't use Borland. Use linux and gcc and you'll have a much better time. Now this might not be true of everyone, but it does support windows binaries too and sure would have felt better to me when I was just trying to learn ANSI C.

C language compiler for new OS (theoretical questions)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Let’s assume that I wrote a primitive bootloader using assembly language. The computer is still on real mode. Now I want to write a primitive kernel and shell using C language.
Questions:
1.Do I need to write a C Language compiler in assembly for this new OS or can I use a C compiler running on a different OS? I guess it could be both!
2.If I use a C compiler from a different OS, functions like printf () can be compiled to target the BIOS’s functions instead of the OS’s API to avoid dependencies?
3.If my bootloader switch the computer into protected mode the kernel will need to implement the equivalent to the BIOS functions?
4.Assuming a YES to question 3: If I use a C compiler from a different OS what is required to make it target the new OS kernel functions? Rewriting the headers files?
(EDIT) PD: These are theoretical questions. I don’t need specific details about the actual implementation. I just want to validate the concepts. Don’t feel obligated to answer all of them!
You can do either. I would strongly recommend to just use a standard compiler though. Writing a good compiler is very complex and time consuming.
As long as you do not have an implementation of the standard library just don't use it. You can tell C-compilers to assume that there is no standard library and write your own printf-like functions.
You lose access to the BIOS functions in real mode. If you need them you do need to reimplement them.
Not much change is required actually. Executables are incomplete and require to be linked against something that implements the used standard library functions and whatever other libraries used. All you need to do is link the executable against a (possible self-written) library that somehow implements the required functions.

conio.h not working in C [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 8 years ago.
Improve this question
I'm having trouble with conio.h, I use Eclipse Standard but when I try to use clrscr, textcolor, textbackground, they all remain unresolved please advise me on alternatives or how I can get these to work. Thx.
conio.h is DOS (or turbo-c) specific extension. It defines functions available in in that environment. Don't think its available in standard VC++ or gcc libraries now.
Make sure the .lib are available on the path.

Resources