473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Position File Pointer to newline immediately on some condition

Hi

Is there way to go to the start character of the the proceeding line
while reading from a file. (Sth like working '\n' but immediately will
take me one line down)

Lets say; my file is

abcdefghkl
123 23 43 54
12 3 34 56 77
....
....
....
For example when I am reading a specific line I would like to go to the
start of the newline for some reason.

Thx.

Feb 26 '06 #1
1 2127
TB
utab skrev:
Hi

Is there way to go to the start character of the the proceeding line
while reading from a file. (Sth like working '\n' but immediately will
take me one line down)

Lets say; my file is

abcdefghkl
123 23 43 54
12 3 34 56 77
...
...
...
For example when I am reading a specific line I would like to go to the
start of the newline for some reason.

Thx.


std::ifstream in(...);

in.ignore(std:: numeric_limits< int>::max(),'\n ');

--
TB @ SWEDEN
Feb 26 '06 #2

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

Similar topics

8
3019
by: Peter Abel | last post by:
Hi all, I'm working under W2k with Python 2.2.2 (#37, Oct 14 2002, 17:02:34) on win32 I have a file *test_data.txt* with the following content: 0123456789 0123456789 abcdefghi ABCDEFGHIJKLMNOPQ
1
3611
by: wtnt | last post by:
Hello. I've searched all over and haven't seen another thread with this problem. Please bear with me as I try to explain. thanks. :) I have some programs that need to be cross-platform compatible (unix and windowsXP). The first program parses a text file and records where snippets are in terms of where it begins (char offset from begin of the file) and length (number of chars). One can almost use "byte" and "char" interchangeably...
5
1499
by: Magix | last post by:
Hi, I have following in my data file: <12345><Benjamin><Single> <4567><Stephen><Married> <8383245><George><Married> I want to write a function that display according to the line number given (Max line number is 5), without the '<' and '>'
2
5509
by: Bob Cummings | last post by:
Greetings I am stumped. I am trying to create some initial conditions object by reading from a file. These objects have an integer ID and then a list of sub objects. The problem is I will not know at run time how many sub objects there may be. Here is an example of the input text file. 0 abiebals,20,50,78 acerrubr,100
7
1308
by: Morten Wennevik | last post by:
A bit non topic but ... When using code blocks which do you prefer while( condition ) { stuff } or while( condition )
2
3998
by: Senthil | last post by:
Hi, The need is to read each line in a text file and based on the read data decision has to be taken whether to reposition the file pointer. The StreamReader.Position does not give current position. But it gives position in multiples of 1024. Also, I am not finding a way to reposition the pointer using FileStream-StreamReader combination. Due to this the condition (FileLength = = File Position) misbehaves. I did some investigation and...
3
2870
by: utab | last post by:
Dear all, I have a text file in the form of 1 2 3 4 5 6 --------/--------/--------/--------/--------/--------/ (I just used / to better explain the fields) 6 fields of 8 characters. I want to read lets say fields 4,5 and 6 and then go to the begining of the newline which is in the same format. And
6
41965
by: tomtown.net | last post by:
Hello I'm trying to get a single line removed from a text file using a search pattern (pretty simple: if line contains "NODE1") -> remove line). To achieve this I's like to operate with only the original file and no temp file since the file is 1. on a network resource 2. pretty big 3. accessed by plenty of clients. Copying the file or reading everything into an array and then writing it back using the StreamWriter would lock the file...
6
2653
by: Mahendra | last post by:
I have two cases - 1. When I have a pointer A pointing to a heap memory - What happens when I dereference the pointer A using free(A). It deallocated the heap memory the pointer was pointing to. Is that correct ? 2. If I have a pointer A pointing to a heap memory. Now I create another pointer B which points to same heap memory as pointer A. But now, I do
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9835
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5276
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
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 we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.