473,385 Members | 1,942 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,385 software developers and data experts.

searching for tabs in text file

I'm reading in a text file usein fstream, and I want to look for where
fields are split up by tab seperators. (tab delimited) and read it into the
app, now the fields are variable length characters (how do i read in a
variable length char field?) and how do i tell where the tabs are seperating
the fields? It's been a while since i wrote in c++, thanks!
Nov 16 '05 #1
1 1635
Brian Henry wrote:
I'm reading in a text file usein fstream, and I want to look for where
fields are split up by tab seperators. (tab delimited) and read it
into the app, now the fields are variable length characters (how do i
read in a variable length char field?) and how do i tell where the
tabs are seperating the fields? It's been a while since i wrote in
c++, thanks!


For managed C++:
Read the file line by line (TextReder.ReadLine)

Then split the string using
string[] sl = string.Split("\t");
Now you have an array of strings.
For normal C/C++:
You have to do the abouve thing by hand (manybe you can use STL to help
you; but there is a problem with getline...)

--
Greetings
Jochen

Do you need a memory-leak finder ?
http://www.codeproject.com/useritems/leakfinder.asp
Nov 16 '05 #2

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

Similar topics

1
by: Dan Jacobson | last post by:
In wdg-html-reference/html40/block/pre.html there is no mention about how ASCII tabs (^I) are to be rendered. I suppose all bets are off? Wait, my docs go thru html-tidy first, and it says...
0
by: Wendy Powley | last post by:
I am using a FileSystemObject to open a text file and the ReadLine method to read the file line by line. Set fs = CreateObject("Scripting.FileSystemObject") Set ReptFile =...
6
by: SouthSpawn | last post by:
I am looking for a way to add tabs to my asp.net pages. I saw an application that had tabs on it. It seem as they did it with javascript, because when you click on each tab. It didn't post back to...
2
by: qwweeeit | last post by:
Hi all, from a string embedding tabs I want to colorize them when expanded: # Starting from a string: a= '1234\t5678\t\t90\nqwerty\nasdfg' # which embeds both tabs and lfs # printing it you...
5
by: beliavsky | last post by:
The following code to search a file for tabs does not work, at least on Windows XP. Could someone please tell me what's wrong? Thanks. xfile = "file_with_tabs.txt" for text in open(xfile,"r"):...
135
by: Xah Lee | last post by:
Tabs versus Spaces in Source Code Xah Lee, 2006-05-13 In coding a computer program, there's often the choices of tabs or spaces for code indentation. There is a large amount of confusion about...
6
by: Stephen Edwards | last post by:
I am a novice, so bear with me. I designed a website using CSS TABS, all was fine, then I copy and pasted meta name, etc for keywords, tweaking it where necessary for keywords. I did not notice...
15
by: Tom Plunket | last post by:
The documentation for dedent says, "Remove any whitespace than can be uniformly removed from the left of every line in `text`", yet I'm finding that it's also modifying the '\t' characters, which...
2
by: pankajsingh5k | last post by:
Dear All, Please help me... I had read an article to lazy load a tab in a tabcontainer using an update panel on http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
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...
0
Oralloy
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,...

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.