Hello, All!
Is there any analogous class/function to sscanf() & fscanf() in C#?
In another words, I need to convert string into the set of given
variables of different types.
Regards,
Vladimir.
Winamp 5.0 (playing): Stratovarius - Call Of The Wilderness
(instrumental) 2 1959
Yes, look at the System.Convert class.
--
-----
Sam Gentile
Microsoft MVP - C#/.NET
..NET Blog http://samgentile.com/blog/
Please do NOT contact me directly but respond to
the newsgroup instead.
---------
"Vladimir" <_g************ ***@inbox.ru> wrote in message
news:un******** ******@TK2MSFTN GP09.phx.gbl... Hello, All!
Is there any analogous class/function to sscanf() & fscanf() in C#? In another words, I need to convert string into the set of given variables of different types.
Regards, Vladimir.
Winamp 5.0 (playing): Stratovarius - Call Of The Wilderness (instrumental)
Hello, Sam!
You wrote on Sun, 7 Mar 2004 09:52:47 -0500:
SGM> Yes, look at the System.Convert class.
I don't understand why use System.Convert when you can do typecast directly:
float f = 123.456;
int i = (int) f;
Isn't that more simple?
Then why should I use System.Convert. ToString(...) when every base type has its own one? Also every numeric base type has Parse method.
And last, sscanf() converts string to a series of variables while System.Convert. To<...>(string) return only one value.
Regards,
Vladimir.
Winamp 5.0 (not active)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Vladimir |
last post by:
Hello, All!
Is there any analogous class/function to sscanf() & fscanf() in C#?
In another words, I need to convert string into the set of given
variables of different types.
Regards,
Vladimir.
Winamp 5.0 (playing): Stratovarius - Call Of The Wilderness (instrumental)
|
by: Vladimir |
last post by:
Hello, All!
Is there any analogous class/function to sscanf() & fscanf() in C#?
In another words, I need to convert string into the set of given
variables of different types.
Regards,
Vladimir.
Winamp 5.0 (playing): Stratovarius - Call Of The Wilderness
|
by: Kevin Goodsell |
last post by:
The return value of sscanf should be "the number of input items
assigned" (unless an input failure occurs before any conversion). Are
items assigned due to a "%n" directive included in the returned count?
Thanks.
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
|
by: whisper |
last post by:
Hello: I am trying to write code to read in a bunch of lines from
stdin,
each containing a (variable) number of integers and writing each
integer
in a separate line to stdout.
I came up the code below.
I could not get sscanf to work because it does not increment its
position
|
by: smshahriar |
last post by:
Hi,
I want to scan from the following string all the hex numbers and
populate an array of integers:
0x27 0x00
0x30 0x00
0x33 0x00
0x36 0x00
| |
by: Rob Thorpe |
last post by:
Given the code:-
r = sscanf (s, "%lf", x);
What is the correct output if the string s is simply "-" ?
If "-" is considered the beginning of a number, that has been
cut-short then the correct output is that r = EOF. If it is taken to
be a letter in the stream, then the output should be r = 0, as far as
I can see. My compiler gives EOF.
|
by: baumann |
last post by:
hi,
1) first test program code
#include <stdio.h>
int main(void)
{
char * file = "aaa 23 32 m 2.23 ammasd";
int i2,i3;
|
by: Artemio |
last post by:
Dear folks,
I need some help with using the sscanf() function. I need to parse a
string which has several parameters given in a "A=... B=... C=..." way,
and each has a different type (one is a text string, another is a
decimal, next one is float, etc.).
I have GCC 4.0.1 on Mac OS X Tiger.
Here is an example of what I am trying to do.
|
by: AMP |
last post by:
Hello,
Anybody know if anything exists like sscanf in c.
I found a few things OL but most were pretty old. Maybe something has
come along since 2004?
Thanks
Mike
|
by: a |
last post by:
After reading FAQ comp.lang.c section 12 and googling again, still there is
no threads talking about reading a series of numbers. The input files,
somehow structured, is exemplified below:
<presence/absence of n space/tab on the first n lines>
12
<presence/absence of n space/tab here>0<presence/absence of n space/tab
here>90 10 23 ...
|
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...
| |
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. ...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
| |
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...
|
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...
| |