I want to print the output of programme in "C" language
is it possible
How to print output in the "C" language programming?
Look up the printf() function. That is a good place to start.
Oh! wait if you want to take it directly to the printer then if you are on unix then you can just pipe your program to the printer device.
$ myprogram | lpd
On Windows, you could save your output to a file and then print that file with notepad.
c:\dev\myprogram %26gt;output.txt
c:\dev\notepad output.txt
Reply:Here's some examples
printf ("Hello");
cout%26lt;%26lt;"Hello";
int num = 3;
printf("Num : %d",num)
cout%26lt;%26lt;"Num : "%26lt;%26lt;num;
Reply:Print it how? Not to be mean but one of the fascinating things about these answers is how everyone interprets your question differently. I don't think you're irresponsible but it would be nice if you added in additional information whether you want to print it to the screen or to the printer.
I'm on Linux. I have been for a few years and haven't concerned myself with printing to recent iterations of Windows. Both Linux and MS-Dos (the ancestor of Windows) took from Unix the policy of treating everything as a file, even device drivers. Win32 versions like the last ones I did any programming on, continued this. PRN and LPT1 I believe are the names of the printing device in Windows. stdout is the name of the screen in C, period.
Cout is just wrong, if you're asking about C rather than C++. Cout is stdout in the iostream.h library, which is C++, not C. You send variables to it using the %26lt;%26lt; operator, which is also in iostream. What I have to say below applies to a C++ program, once it's compiled.
The C output is usually taken care of by one of 2 functions: printf("format string", variable1, variable2...); or fprintf(Outputdevice, "format string", variable1, variable2...);. You can see how similar they are. Printf is short for PRINT Format. Fprintf is short for File PRINT Format. Printf is the functional equivalent of fprintf(stdout, "format string", ...); Of course you should read the documentation which will tell you among other things, that if you don't have any variables in your format string, you don't need a comma and variable list after, and you only need as many variables in your list as you have indicated in your format string. Most C compilers don't have names for your printer, so if your documentation doesn't indicate one you probably can't make fprintf(PRN...) work. You have two choices. You can use printf or you can open up a file and fprintf your output to the file. Then of course you can send the output file to your printer. In Unix and in older MS/Dos/Windows you can send it a couple of ways. In Unix/Linux just type lpr filename or executable_file %26gt; lpr. In Windows, type executable_file %26gt; prn or print filename. In Windows you will be asked if you want to overwrite prn. Answer yes. Windows treats your prn as a file, but it isn't a file, it's a device, so instead of messing up your driver you will be sending all the characters to the device to print out.
I know this sounds heavy but I'm tired. I hope it helps.
Reply:Use the printf function, which is included in the stdio.h header file.
To include said header file, simply put #include %26lt;stdio.h%26gt; at the very top of your code (this is a preprocessor instruction).
Using printf is simple - it takes a single string argument/parameter, and you can use %d, %f etc to substitute with various variables which can also be passed to the function as extra arguments.
Reply:For Free C++ Lessons For Beginner
Enter Programming_Share Group
Omar Abdallah
Tuesday, July 14, 2009
Help me regarding Computer Ports using C language?
Is there any way of sending a stream of bits from Serial or parallel port of my computer using C language?
Help me regarding Computer Ports using C language?
Try using functions like inport(for reading the port) and outport(for sending data to the port) in dos.h. These functions require a port no. where U want to send the data and the data (binary data converted into decimal, like U wanna active first 4 data pins of Ur parallel port and deactivate the remaining 4 then U can use the data 11110000, which when converted to decimal gives 240, so enter this value along with the port no. while calling the function).
Reply:Yes, in most compilers there are functions called inportB %26amp; outportB that are designed for that. Look in your compiler's docs. Also, you can open a file to either divice using a DOS name in a DOS environment. If, however, you want to create a Win32s API application, then you need to find the API calls to do this. Start at the URL below.
Reply:At codeproject you will find tons of ready projects with full sources.
Reply:Certainly. You write to the port just like writing to a file. That is, you create a handle to the "file" and write to it, then close it. I recommend reading the documentation.
Reply:yes i tcan be done........... but i donno how to do that...........
garden flowers
Help me regarding Computer Ports using C language?
Try using functions like inport(for reading the port) and outport(for sending data to the port) in dos.h. These functions require a port no. where U want to send the data and the data (binary data converted into decimal, like U wanna active first 4 data pins of Ur parallel port and deactivate the remaining 4 then U can use the data 11110000, which when converted to decimal gives 240, so enter this value along with the port no. while calling the function).
Reply:Yes, in most compilers there are functions called inportB %26amp; outportB that are designed for that. Look in your compiler's docs. Also, you can open a file to either divice using a DOS name in a DOS environment. If, however, you want to create a Win32s API application, then you need to find the API calls to do this. Start at the URL below.
Reply:At codeproject you will find tons of ready projects with full sources.
Reply:Certainly. You write to the port just like writing to a file. That is, you create a handle to the "file" and write to it, then close it. I recommend reading the documentation.
Reply:yes i tcan be done........... but i donno how to do that...........
garden flowers
From where can i get software for "c" language?????
Hi i am doing "c" language course.I want the software in which i can practise all the commands and instruction .I mean i have a software called TURBO C++ but it didn't work.please tell me from where i can download it.best answer will be given 15 points.
From where can i get software for "c" language?????
Visual Studio
http://www.microsoft.com/express/vc/
Reply:A great C/C++ IDE to learn with is Dev-C++:
http://www.bloodshed.net/devcpp.html
If you are more of a command-line guy (or just want to get a *nix type feel), try MinGW or Cygwin:
http://www.mingw.org/
http://www.cygwin.com/
If you want the ultimate command-line/native learning experience, install a Linux distro.
Reply:Microsoft releases a free version of Visual C++ .NET you can get info here
http://www.microsoft.com/express/vc/
You can also get a compiler here
http://www.mingw.org/
Hope this helps
Reply:You can download the Tiny C compiler at http://fabrice.bellard.free.fr/tcc/
Other C compilers are listed on Wikipedia:
http://en.wikipedia.org/wiki/List_of_com...
From where can i get software for "c" language?????
Visual Studio
http://www.microsoft.com/express/vc/
Reply:A great C/C++ IDE to learn with is Dev-C++:
http://www.bloodshed.net/devcpp.html
If you are more of a command-line guy (or just want to get a *nix type feel), try MinGW or Cygwin:
http://www.mingw.org/
http://www.cygwin.com/
If you want the ultimate command-line/native learning experience, install a Linux distro.
Reply:Microsoft releases a free version of Visual C++ .NET you can get info here
http://www.microsoft.com/express/vc/
You can also get a compiler here
http://www.mingw.org/
Hope this helps
Reply:You can download the Tiny C compiler at http://fabrice.bellard.free.fr/tcc/
Other C compilers are listed on Wikipedia:
http://en.wikipedia.org/wiki/List_of_com...
A good book & website for C language ??
hey guyz, im starting practicing C LANGUAGE, so i need a name of a good C BOOK %26amp; WEBSITE, so tht i can refer to it .. if get messed up..
help will be appreciated
A good book %26amp; website for C language ??
K%26amp;R's The C Programming Language.
http://cprogramming.com/
http://c-faq.com/
and finally... GOOGLE.
Reply:As the man sez above, google 'tutorial c language'. Also, K%26amp;R can't be beat, although there are some 'dummies' or 'nutshell' or '...in 24 hours' books that take a different approach.
calling cards
help will be appreciated
A good book %26amp; website for C language ??
K%26amp;R's The C Programming Language.
http://cprogramming.com/
http://c-faq.com/
and finally... GOOGLE.
Reply:As the man sez above, google 'tutorial c language'. Also, K%26amp;R can't be beat, although there are some 'dummies' or 'nutshell' or '...in 24 hours' books that take a different approach.
calling cards
Is it possible to learn C language by self study with specified book and a PC?
pls suggest me a c language book for learning from basics!
Is it possible to learn C language by self study with specified book and a PC?
yes.
refer +2 c books for basics.
Reply:Yes, you need a lot of books as reference, I'm sure you can find 1 in the library before you invest on 1 to keep.
No, you need to try it out so you have to get an Intergrated Development Environment(IDE) and the complier here is free software.
http://www.download.com/Bloodshed-Dev-C-...
Reply:yes and yes
bookpool.com
cheap books for study,
else go to devshed.com for answers.
Reply:C++ for Dummies. No offense intended. You can find it at Amazon.com.
Reply:C by Yashwant Kanetkar. Amazingly easy and lucid.
Reply:If you know the computer basics, you can start immediately.
It is always better to have mentor to phase up your learning.
Start with any good book with fewer pages, it gives you confidence when you finish your first book.
Reply:Yes you can! There are a ton of books and web site tutorials, search Google. And there are free compilers. Linux has a couple of good ones. Novel Linux Desktop ( SUSE )has an awesome IDE environment that you can download for free that will compile/assemble a large number of languages including C and it is GUI based.
Reply:Yes it is possible to learn C... The best book available is
"Programming in C by Dennis Ritchie". There is also a book by Lafore but i am not sure abt the Title
Is it possible to learn C language by self study with specified book and a PC?
yes.
refer +2 c books for basics.
Reply:Yes, you need a lot of books as reference, I'm sure you can find 1 in the library before you invest on 1 to keep.
No, you need to try it out so you have to get an Intergrated Development Environment(IDE) and the complier here is free software.
http://www.download.com/Bloodshed-Dev-C-...
Reply:yes and yes
bookpool.com
cheap books for study,
else go to devshed.com for answers.
Reply:C++ for Dummies. No offense intended. You can find it at Amazon.com.
Reply:C by Yashwant Kanetkar. Amazingly easy and lucid.
Reply:If you know the computer basics, you can start immediately.
It is always better to have mentor to phase up your learning.
Start with any good book with fewer pages, it gives you confidence when you finish your first book.
Reply:Yes you can! There are a ton of books and web site tutorials, search Google. And there are free compilers. Linux has a couple of good ones. Novel Linux Desktop ( SUSE )has an awesome IDE environment that you can download for free that will compile/assemble a large number of languages including C and it is GUI based.
Reply:Yes it is possible to learn C... The best book available is
"Programming in C by Dennis Ritchie". There is also a book by Lafore but i am not sure abt the Title
I want a program in c language that execute ADI method for 2 dimensional parabolic pde?
i need a written program in c language to execute ADI method fo a 2 dimensional parabolic pde.
I want a program in c language that execute ADI method for 2 dimensional parabolic pde?
You may have to write it yourself. Have you looked at MatLab or any of those?
Doug
I want a program in c language that execute ADI method for 2 dimensional parabolic pde?
You may have to write it yourself. Have you looked at MatLab or any of those?
Doug
Sunday, July 12, 2009
I always heard about C++ , VIsual Basic and other C language. Can someone explain about Q basic?
is it q basic some kind like C++ language? How to use and is there any special system or download or etc.
I always heard about C++ , VIsual Basic and other C language. Can someone explain about Q basic?
Here's link regarding QBASIC. You can download it from the link below.
Here is a link for download of Visual Basic for DOS - it's free!
Reply:QBASIC is old
Reply:QBasic was a programming environment shipped with MS-DOS.
and a lot of good features, but its main problem was that you couldn't make executable programs with it, you had to enter the QBasic environment in order to run it. And as it was an MS-DOS program you could make only DOS programs and couldn't take advantage of the Windows libraries.
QBasic version 4.5 also made exe files.
Visual Basic based its syntax on QBasic.
Reply:QBASIC stands for quick Basic, we can say it is a version of very old BASIC language. the other version is GW BASIC, but today it is of no use, it was used earlier to teach programming to the beginners.
Reply:QBasic, the name derived from QuickBasic. The expansion of BASIC is Beginner's All-purpose Symbolic Instruction Code.
This is one of the earliest high level programming language using which we can create software programs.
It was originally designed in 1963, by John George Kemeny and Thomas Eugene Kurtz at Dartmouth College.
I don't know what you are trying to achieve using a language that had been frequently in PC DOS era.
C++ is a powerful language based on C programming language that supports structured programming as well as object-oriented programming.
I always heard about C++ , VIsual Basic and other C language. Can someone explain about Q basic?
Here's link regarding QBASIC. You can download it from the link below.
Here is a link for download of Visual Basic for DOS - it's free!
Reply:QBASIC is old
Reply:QBasic was a programming environment shipped with MS-DOS.
and a lot of good features, but its main problem was that you couldn't make executable programs with it, you had to enter the QBasic environment in order to run it. And as it was an MS-DOS program you could make only DOS programs and couldn't take advantage of the Windows libraries.
QBasic version 4.5 also made exe files.
Visual Basic based its syntax on QBasic.
Reply:QBASIC stands for quick Basic, we can say it is a version of very old BASIC language. the other version is GW BASIC, but today it is of no use, it was used earlier to teach programming to the beginners.
Reply:QBasic, the name derived from QuickBasic. The expansion of BASIC is Beginner's All-purpose Symbolic Instruction Code.
This is one of the earliest high level programming language using which we can create software programs.
It was originally designed in 1963, by John George Kemeny and Thomas Eugene Kurtz at Dartmouth College.
I don't know what you are trying to achieve using a language that had been frequently in PC DOS era.
C++ is a powerful language based on C programming language that supports structured programming as well as object-oriented programming.
Subscribe to:
Posts (Atom)