Hey guys,
I cant seem to figure this one out and I looked everywhere for it. My question is how do I read this line of text from an input file into an array
@attribute outlook {sunny, overcast, rainy}
I want to put the word outlook, sunny, overcast, and rainy into an array or just atleast into strings but without the "{" and the ",". I am writing this in c++.
Any suggestions would be appreciated. Thanks
3 4371 sicarie 4,677
Recognized Expert Moderator Specialist
Hey guys,
I cant seem to figure this one out and I looked everywhere for it. My question is how do I read this line of text from an input file into an array
@attribute outlook {sunny, overcast, rainy}
I want to put the word outlook, sunny, overcast, and rainy into an array or just atleast into strings but without the "{" and the ",". I am writing this in c++.
Any suggestions would be appreciated. Thanks
You could do them individually. As long as you didn't have too many...
attribute[i] = "sunny"
attribute[i+1] = "overcast"
etc...
Ganon11 3,652
Recognized Expert Specialist
I think his question is not so much how to get the array working, but how to read that line from a file and be able to separate the words from each other.
I'd start by reading the line into a string variable, and then using .find() to find the 'limits' of each word - for example, to get outlook, you know it is between a space and a '{', so you can use .find() and .substr() to isolate that word.
sicarie 4,677
Recognized Expert Moderator Specialist
I think his question is not so much how to get the array working, but how to read that line from a file and be able to separate the words from each other.
I'd start by reading the line into a string variable, and then using .find() to find the 'limits' of each word - for example, to get outlook, you know it is between a space and a '{', so you can use .find() and .substr() to isolate that word.
That makes much more sense - I got confused with the notation, as that's how you represent an array in PERL.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: sahukar praveen |
last post by:
Hello,
I have a question.
I try to print a ascii file in reverse order( bottom-top). Here is the logic.
1. Go to the botton of the file fseek(). move one character back to avoid the EOF.
2....
|
by: siliconwafer |
last post by:
Hi All,
I want to know tht how can one Stop reading a file in C (e.g a Hex
file)with no 'EOF'?
|
by: EdUarDo |
last post by:
Hi all, I'm not a newbie with C, but I don't use it since more than 5 years...
I'm trying to read a text file which has doubles in it:
1.0 1.1 1.2 1.3 1.4
2.0 2.1 2.2 2.3 2.4
I'm doing...
|
by: Freddy Coal |
last post by:
Hi, I'm trying to read a binary file of 2411 Bytes, I would like load all
the file in a String.
I make this function for make that:
'--------------------------
Public Shared Function...
|
by: Lonifasiko |
last post by:
Hi,
Using Process class I asynchronously launch an executable (black box
executable) file from my Windows application. I mean asynchronously
because I've got an EventHandler for "Exited" event....
| |
by: archana |
last post by:
Hi all,
I want to read csv file into datatable. Is there any csv reader and
writer available for freeware.
I am reading csv file using schema.ini file. I don't want this
dependency. The...
|
by: tackleberi |
last post by:
hi, im having some trouble reading a file into java and then storing it in an array here the code i have so far:
import java.io.FileNotFoundException;
import java.io.FileReader;
import...
|
by: Srinivas3279 |
last post by:
I am new to the C/C++
My Program:
int main(int argc, _TCHAR* argv)
{
//Declarations
FILE *fp;
|
by: sachinwadi |
last post by:
Hi,
Sachin here.
I have a problem with XML using with VB6.0.
I Have a XML file of size nearly 129MB.
I am reading the file using XML DOM object and the retrieved record i am inserting into...
|
by: electromania |
last post by:
Hi,
Im reading a file, with 2 columns. this is working
as Im reading I want to be able to count how many rows I've read and also add the all values as im reading from the second column, could...
|
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: 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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |