473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Fwd: sscanf() & fscanf()

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)
Nov 22 '05 #1
2 1943
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**************@TK2MSFTNGP09.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)

Nov 22 '05 #2
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)
Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
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,...
2
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,...
4
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...
3
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...
4
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
6
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...
10
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;
8
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...
20
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
5
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: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.