Hi. Is there any function like getline which loads specified line from
a text file? Something like getline(myfile, line, 10); where 10 means
10th line in the file. 4 1891 ra*******@gmail.com wrote:
Hi. Is there any function like getline which loads specified line from
a text file? Something like getline(myfile, line, 10); where 10 means
10th line in the file.
No. It's too easy to write using 'getline' and 'ignore' to bother
putting it in the library, methinks.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
On Aug 6, 4:43 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
raven....@gmail.com wrote:
Hi. Is there any function like getline which loads specified line from
a text file? Something like getline(myfile, line, 10); where 10 means
10th line in the file.
No. It's too easy to write using 'getline' and 'ignore' to bother
putting it in the library, methinks.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
So how to code it? ra*******@gmail.com wrote:
On Aug 6, 4:43 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
>raven....@gmail.com wrote:
>>Hi. Is there any function like getline which loads specified line from a text file? Something like getline(myfile, line, 10); where 10 means 10th line in the file.
No. It's too easy to write using 'getline' and 'ignore' to bother putting it in the library, methinks.
V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask
So how to code it?
Something like
std::istream& skip_lines(std::istream& is, std::size_t n)
{
while (is && n--)
is.ignore(
std::numeric_limits<std::istream::streamsize>::max (),
'\n');
return is;
}
...
std::ifstream myfile; // and open it
if (skip_lines(myfile, 10))
getline(myfile, line);
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
In article <11**********************@k79g2000hse.googlegroups .com>, ra*******@gmail.com says...
Hi. Is there any function like getline which loads specified line from
a text file? Something like getline(myfile, line, 10); where 10 means
10th line in the file.
No -- to do something like that, you'd need an index of the text file
telling where each line begins. You can do that, but it's not built in.
--
Later,
Jerry.
The universe is a figment of its own imagination. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sandy |
last post by:
See line beginning with WHAT GOES HERE .....
Do Until .........................
Code
....
....
If .............. Then
WHAT GOES HERE TO JUMP TO THE END OF THE LOOP AND LOOP AGAIN
End If...
|
by: René |
last post by:
Hello
I'm developing a program in c# that uses a RichTextBox.
Now i wonder, how can i jump to a specific line in the document that is
shown in that richtextbox?
/René
|
by: paul c |
last post by:
Apologies if I'm sending this to the wrong group. If so I'd be grateful
if somebody could point me to the right one.
I'm using microsoft visual c++ 6.0 compiler. My code is C, I just use
the...
|
by: Dave E |
last post by:
Hi folks,
I have a VB.Net application, currently being developed on my XP Pro 2002 SP2
box. It is pretty straightforward and accesses my local SQL2000 instance.
Randomly I get the above error...
|
by: robert d via AccessMonster.com |
last post by:
When my app starts up, it creates a temporary database. This temp database
is created from a 'model' database that is in the same folder as the
application. Because there is a model, the creation...
| |
by: questions? |
last post by:
I opened a file with
fileptr=fopen(filaneme,"r");
I then use
fgets(a_string, sizeof(a_string),fileptr);
to read each line.
How to jump over a prespecified number of lines without doing...
|
by: Todd A. Anderson |
last post by:
I have a function foo of which I need to get the address. The problem
is that when you say "&foo" (or just foo for that matter), you get the
address of this function's entry in a jump table and...
|
by: Horacius ReX |
last post by:
Hi, sorry but after looking for information, I still did not get how,
when reading a text file in python, can one jump to a concrete line
and then read the different data (separated by spaces). In...
|
by: teddysnips |
last post by:
I've been asked to take over maintenance of a database. The client
has also requested that I split the database into Front End/Back End.
I've just taken delivery of the code and I've run it and it...
|
by: Fary4u |
last post by:
Hi
hope anybody sort this problem i've got
-> progress bar which control with the coding & it's jumps into time line.
what i would like to do
-> on the same time it's jump into the particular...
|
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,...
| |
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: 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: 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: 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.
| |