Sponsored Content
Full Discussion: Why I don't get any output?
Top Forums Programming Why I don't get any output? Post 302089084 by jim mcnamara on Saturday 16th of September 2006 08:49:41 PM
Old 09-16-2006
You are confusing something called a "scanset" with what sscanf is doing in your example. A scanset is a CLASS of characters, for example, all lowercase:

Code:
/* sscanftest.c*/
int main()
{
	char	mystring[256];
	printf("Enter a string in lower case ");
	scanf("%[ a-z]",mystring); /* allow space character and all lc letters */
	printf("The string was ||%s||\n",mystring);
	return 0;
}

Here is what you get:
Quote:
$ sscanftest
Enter a string in lower case hello world
The string was ||hello world||
$ sscanftest
Enter a string in lower case hello, unix world
The string was ||hello||
$ sscanftest
Enter a string in lower case abcd1234
The string was ||abcd||
$
Notice:
1. the scanset does not look for a particular string like "model name"
scansets filter in (or out with ^ as the first character) desired characters.


2. it stops scanning when it hits a character not in the scanset - like the comma

In other words, sscanf does not do what you want it to do - look for a given string.
Your syntax should be "%[ <scanset goes here> ]".

Bottom line -- the strstr answer you already got works. scansets are not the
desired way to go here. HTH
 

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Don't allow to editing !!!

Hi All, Assume that there is file1 file,userA and userB have got read,write and execute permission for file1. when userA open file1, userB cant change(write,editing file etc...) content of file1. after userA exit of file1 , userB can change(write, editing file etc..). Shortly i want... (1 Reply)
Discussion started by: temhem
1 Replies

2. Programming

std::cout and gfortran print*, don't output to the screen

I am not sure where to post this other than here. I am trying to figure out why an app gives different output when compiled under Ubuntu 10.10 and CentOS 5.5. I am pretty sure that the issue is that the Cent version has gcc 4.1 installed, while Ubuntu has gcc 4.4. I am trying to print from some... (20 Replies)
Discussion started by: LMHmedchem
20 Replies

3. Shell Programming and Scripting

AIX -/usr/bin/expect shows output Don't know why.

Hi, I have been programming with the expect program for a while now and have create a series of menu driven checks for the operations team. One thing I have noticed is that I call a remote script and pass parameters and this is display on the screen....for example. Within the script ... (0 Replies)
Discussion started by: yakky
0 Replies

4. Shell Programming and Scripting

Find command don't output anything, but file is there

Please if You can help me debug why nothing is found by this command? # echo "Zeus Robot" >> /home/vps/190/test # cat /home/vps/190/test Zeus Robot # find /home/vps -type f -mtime 2 -size -1000k -exec grep -l "Zeus Robot" {} \; >> out # cat out # cat /home/vps/190/test Zeus Robot Why... (6 Replies)
Discussion started by: postcd
6 Replies

5. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies
Tcl_UtfToUpper(3)					      Tcl Library Procedures						 Tcl_UtfToUpper(3)

__________________________________________________________________________________________________________________________________________________

NAME
Tcl_UniCharToUpper, Tcl_UniCharToLower, Tcl_UniCharToTitle, Tcl_UtfToUpper, Tcl_UtfToLower, Tcl_UtfToTitle - routines for manipulating the case of Unicode characters and UTF-8 strings SYNOPSIS
#include <tcl.h> Tcl_UniChar Tcl_UniCharToUpper(ch) Tcl_UniChar Tcl_UniCharToLower(ch) Tcl_UniChar Tcl_UniCharToTitle(ch) int Tcl_UtfToUpper(str) int Tcl_UtfToLower(str) int Tcl_UtfToTitle(str) ARGUMENTS
int ch (in) The Tcl_UniChar to be converted. char *str (in/out) Pointer to UTF-8 string to be converted in place. _________________________________________________________________ DESCRIPTION
The first three routines convert the case of individual Unicode characters: If ch represents a lower-case character, Tcl_UniCharToUpper returns the corresponding upper-case character. If no upper-case character is defined, it returns the character unchanged. If ch represents an upper-case character, Tcl_UniCharToLower returns the corresponding lower-case character. If no lower-case character is defined, it returns the character unchanged. If ch represents a lower-case character, Tcl_UniCharToTitle returns the corresponding title-case character. If no title-case character is defined, it returns the corresponding upper-case character. If no upper-case character is defined, it returns the character unchanged. Title-case is defined for a small number of characters that have a different appearance when they are at the beginning of a capitalized word. The next three routines convert the case of UTF-8 strings in place in memory: Tcl_UtfToUpper changes every UTF-8 character in str to upper-case. Because changing the case of a character may change its size, the byte offset of each character in the resulting string may differ from its original location. Tcl_UtfToUpper writes a null byte at the end of the converted string. Tcl_UtfToUpper returns the new length of the string in bytes. This new length is guaranteed to be no longer than the original string length. Tcl_UtfToLower is the same as Tcl_UtfToUpper except it turns each character in the string into its lower-case equivalent. Tcl_UtfToTitle is the same as Tcl_UtfToUpper except it turns the first character in the string into its title-case equivalent and all fol- lowing characters into their lower-case equivalents. BUGS
At this time, the case conversions are only defined for the ISO8859-1 characters. Unicode characters above 0x00ff are not modified by these routines. KEYWORDS
utf, unicode, toupper, tolower, totitle, case Tcl 8.1 Tcl_UtfToUpper(3)
All times are GMT -4. The time now is 07:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy