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

How to read particular column values from file?

Hi All,

I have a file which contains set of data in the following format.

Title1
Title1, Title2,
Title3
A B C D
1 1 1 1
2 3 4 6
6 7 6 7

I want to read the third column values only. Please help me.

Regards,
Nelson
Feb 9 '11 #1
5 5131
horace1
1,510 Expert 1GB
I would read all the values, discarding the ones not required
Feb 9 '11 #2
What is the logic?
Feb 9 '11 #3
horace1
1,510 Expert 1GB
somethink like
Expand|Select|Wrap|Line Numbers
  1.    int a, b, c, d;
  2.    scanf("%d%d%d%d", &a, &b, &c, &d);
  3.  
use the value in c igniore the rest?
Feb 9 '11 #4
I need column values like:
C
1
4
6
Feb 9 '11 #5
horace1
1,510 Expert 1GB
are you columns always on character wide if so you could try something like
Expand|Select|Wrap|Line Numbers
  1. char a,b,c,d;
  2. scanf(%c %c %c %c", &a, &b, &c, &d);
  3.  
then look at the character to see if it is a digit or some other character
Feb 9 '11 #6

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

Similar topics

3
by: jrlen balane | last post by:
how would i read a tab delimited file? at the same time put what i read in an array, say for example that i know that the file is an array with column= 5 and row=unknown.
3
by: ssb | last post by:
Hello, This may be very elementary, but, need help because I am new to access programming. (1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor ?) the values one by one and...
0
by: Vikram | last post by:
I want comma seprated string of all the values in a particular column of a datatable. Is there any method available in datatable or any other easier way instaed of looping through the datatable. ...
3
by: hazz | last post by:
The datareader below contains two rows of two columns but in the for loop, the values for only the first row are getting printed twice. How do I get to the values of the second row? Thanks. -hazz...
2
by: Bill Nguyen | last post by:
I need to parse a text file with fixed columns into a table. I have the file spec (column positions) but don't know how to use it. Thanks Bill
2
by: redalpha | last post by:
Hi friends, I am facing problem in finding a code which should read particular column in text file.My code opens a file split it into an array & search the string but it search that...
1
by: san1014 | last post by:
Hi I have a table SQL> select * from nodes; NODE_ID NODE_NAME -------------------- ------------------------------ N1 Kothhapet N2 Nagole...
8
by: meiliong | last post by:
I would like to read a column of data in csv file on each rows and get the data to perform calculation as shown below: "Sample Number","POD1","POD5","Time" 803,E7,03, 1803,E7,03,3.3330 us...
5
by: meiliong | last post by:
Read data from csv file using c++ Question posted by: meiliong (Newbie) on Yesterday 10:00 AM I would like to read a column of data in csv file on each rows and get the data to perform calculation...
1
by: Vinarashi | last post by:
Hi, I am trying to load a data file into database. The data should be rejected if one particular column is null. As far as i googled, there is only one way, I should make that column "not null" in...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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...

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.