It seems that the standard c library doesn't give any support on
this. I googled this question and found that the code would not be
portable. Then how can I do this under linux ? Thanks! ^_^ 3 1476
Gestorm <zh********@126 .comwrites:
It seems that the standard c library doesn't give any support on
this. I googled this question and found that the code would not be
portable. Then how can I do this under linux ? Thanks! ^_^
You can start by asking in a Linux-specific newsgroup.
(Note that this might not be possible under Linux, depending on the
nature of the terminal or terminal emulator you're using.)
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
On Sun, 15 Jun 2008 19:38:01 -0700, Gestorm wrote:
It seems that the standard c library doesn't give any support on this.
I googled this question and found that the code would not be portable.
Then how can I do this under linux ? Thanks! ^_^
It is not a Linux specific thing it is a terminal type specific thing.
On my terminal I can use:
fputs( "\033[31mHello World!\n", stdout );
Lookup the different codes on: http://www.ibm.com/developerworks/li.../l-tip-prompt/
in particular, lookup the code for how to reset it back to what might be
the "correct" colour. My PS1 (prompt) variable does this for me so I
haven't included it above.
If you want to play with this sort of thing, remember that when you screw
up your terminal, you can usually type reset[enter] to get it back, and
this usually works even if you can't see the letters coming up.
On Jun 16, 2:10 pm, viza <tom.v...@gmil. comwrote:
It is not a Linux specific thing it is a terminal type specific thing.
On my terminal I can use:
fputs( "\033[31mHello World!\n", stdout );
Lookup the different codes on:http://www.ibm.com/developerworks/li.../l-tip-prompt/
in particular, lookup the code for how to reset it back to what might be
the "correct" colour. My PS1 (prompt) variable does this for me so I
haven't included it above.
If you want to play with this sort of thing, remember that when you screw
up your terminal, you can usually type reset[enter] to get it back, and
this usually works even if you can't see the letters coming up.
Very helpful, thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ME |
last post by:
I am trying to find a prewritten method for converting a string like
this:"Hello World" to this "Hello\sWorld". I plan to use it to build a
regular expression. Specifically I am looking for a method that can convert
not just space (\s) but also any character that needs to be escaped in a
given string.
Thanks,
Matt
|
by: ankursinha |
last post by:
Hi,
Is it possible to write a C program that prints "Hello World" on screen without
having a single semi-colon in the entire program?
The extra constraint here is that u r not allowed to use if,while,switch etc.
So far,i figured this could be done by insertint the printf statement in main
as shown:
int main(int argc=printf("Hello world")
|
by: ranveerkunal |
last post by:
where are string literals stored : data segement, stack
ex.
char *test()
{
return("hello");
}
int main()
{
puts(test());
return 0;
|
by: vijay |
last post by:
Hello,
As the subject suggests, I need to print the string in the reverse
order. I made the following program:
# include<stdio.h>
struct llnode
{
char *info;
|
by: saurabhnsit2001 |
last post by:
The following program doesn't "seem" to print "hello-out". (Try
executing it)
#include <stdio.h>
#include <unistd.h>
int main()
{
while(1)
{
fprintf(stdout,"hello-out");
| |
by: jningombam |
last post by:
Hi all,
Could anyone please help me to print "Hello World" in C programming language without including any code inside main function
Regards.
|
by: arnuld |
last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to
remove some parts of programme and experiment with error, so here i
go:
#include <stdio.h>
int main () {
printf('hello world\n');
}
|
by: Andrea |
last post by:
Hi, I'm a newbie i want to know how can i convert string to its binary
representation, i want to write a program where an example string
"hello world" is transformed in his binary representation
"11010010101...." and viceversa and then print on the stdout the
result of the two representation.
thanks in advance,
Andrea
|
by: Gerardo Herzig |
last post by:
Hi all. Im having some "problems" with a small concurrent plpython function.
Based on a small example about concurrent programming, there is some
code which works fine under python:
#! /usr/bin/python
import threading, random
import time
def myPrint(str):
|
by: Bill H |
last post by:
Everyone probably started with the infamous print "hello world" as
their 1st program. I am looking for a site online that basically does
the same for php & database communication. A site that walks you
through the basic fundementals on how to setup and access a simple
database so I can experiment and get a feel for it before diving in
deep. Is there anyplace like this out there?
Bill H
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |