I used to code in C language in the past and I found the scanf
function very useful. Unfortunately, there is no equivalent in C#.
I am using using it to parse semi-structured text files.
I found an interresting example of scanf
implementation here. Unfortunately, it looks old and incomplete.
Does anyone know a scanf
C# implementation ? Or at least something that would work as a reversed string.Format
?
The for loop in C language is used to iterate the statements or a part of the program several times. It is frequently used to traverse the data structures like the array and linked list.
Get started with C. Official C documentation - Might be hard to follow and understand for beginners. Visit official C Programming documentation. Write a lot of C programming code - The only way you can learn programming is by writing a lot of code.
C was designed as a minimalist language to be used in writing operating systems for minicomputers, such as the DEC PDP 7, which had very limited memories compared with the mainframe computers of the period. The language was devised during 1969–73, alongside the early development of the UNIX operating system.
Since the files are "semi-structured" can't you use a combination of ReadLine() and TryParse() methods, or the Regex class to parse your data?
If regular expressions aren't working for you, I've just posted a sscanf()
replacement for .NET. The code can be viewed and downloaded at http://www.blackbeltcoder.com/Articles/strings/a-sscanf-replacement-for-net.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With