473,468 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

While reading character data from a file.

3 New Member
I have a file with data that comes in columns of characters and integers. I am interested in the character in the first column only.
Data sample:
HGFTY GGHH64 34hjhjkk
YHEO 34' FGGTR ghhh6778
.
.
.
GHJKN TYUU4456 778OPPKJ

So, I am interested in the above example only in HGFTY, YHEO, and GHJKN.
How do I tell "FILEname >>" to skip to the next line after reading the first Character Word and so on? I can test for "blank space" no problem.
Regards,

MAB
Feb 18 '11 #1
4 2301
mac11
256 Contributor
I think you'd be better off using getline() rather than >>

Then just split off the part you want and ignore the part you don't
Feb 18 '11 #2
Miguel Bujan
3 New Member
Thanks mac11:

I found out about getline() and I am using it but my "if" is failing cause in between the words there is a tab not a space. How do I check for tab knowing that in the ASCII table is number 9.

So far this is failing:

if (Oneline[i] != ' ') then whatever;

Regards,

MAB
Feb 18 '11 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
A tab is a \t.
Feb 20 '11 #4
Miguel Bujan
3 New Member
Thanks to all. I fixed it.

Cheers,

MAB
Feb 20 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: shrishjain | last post by:
Dear All, I am having problem in reading bytes from a binary file. I read the file in following way: ifstream in("filename"); char c; while(true) { in.read(&c, 1); if(in.eof()){
5
by: Lenard Gunda | last post by:
hi! I have the following problem. I need to read data from a TXT file our company receives. I would use StreamReader, and process it line by line using ReadLine, however, the following problem...
2
by: Erland | last post by:
Hi all, I have made an ASP.NET 1.1 application on windows 2000 advanced server. In the application, i have saved the file using the following code string str; str="this is my data";...
4
by: personguy | last post by:
I'm trying to read one column at a time from this data file: 24551 145.5 62.3 2.13 24582 153.7 63.0 2.52 26553 160.4 58.8 2.51 26613 159.5 58.9 2.02 26624 160.5 61.5 1.98 27725 170.9 62.5...
2
by: jesseKTabor | last post by:
I got all of these integers on a data file. I want my while loop to read the range of the integers from highest to lowest. How do you make the loop read all of these integers from highest to...
5
by: aboxylica | last post by:
I have a file which contains something like this >ref|NC_001133| CCACACCACACCCACACACCCACACACCACACCACACACCACACCACACCCACACACACA CATCCTAACACTACCCTAACACAGCCCTAATCTAACCCTGGCCAACCTGTCTCTCAACTT...
13
by: rizzie | last post by:
I am currently creating a program in vb6 that reads thousands of lines from a text file. So I use loop to read each line. It works perfectly but the problem occur when I run the program and try to...
10
by: HardySpicer | last post by:
I have a cvs data file orbit.csv and found this code. function ReadFile() { var fso, f1, ts, s; var ForReading = 1; fso = new ActiveXObject("Scripting.FileSystemObject"); f =...
1
by: ShafeeqRahman | last post by:
I am not getting the value of some excel cells while reading it from vb6. The code is as follows. The cells has some numeric values. Is it the problem of the format of the cells in excel. When I...
2
by: Steven Cheng | last post by:
Hi Gary, As for the setting you mentioned, it is used to custimze the received data size limitation of WCF binding(such as NetTcpBinding or HttpBinding). After you have definite a customized...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
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...
1
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...
0
agi2029
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,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.