473,509 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Increment File Pointer In A Text File

6 New Member
HI...
Actually i m trying to move my file pointer from one line to another line but m not able to do so by using fseek because i dont know the offset.......

so is there anybody who can help........

thanks
Jul 9 '07 #1
3 4429
Silent1Mezzo
208 New Member
HI...
Actually i m trying to move my file pointer from one line to another line but m not able to do so by using fseek because i dont know the offset.......

so is there anybody who can help........

thanks
Are you just going to the next line?
Jul 9 '07 #2
aditigupta
6 New Member
no i want to move to any line from the present file pointer position......... is there any way out.......
Jul 10 '07 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
Do you have a flat file? That is, are all of the records the sam length??

If so, you can calculate an offset from the beginning of the file and seek to that location.

If not, you will have to start at the beginning of the file and read it character by character counting the end of record characters (probably \n). As you find an end of record character, the next record starts at the next byte. Seek to that byte.

I urgently recommend a flat file for this type of random hopping about. Further, if you have to change the data and the records are different lengths, then you simply can't do it without corrupting the file.
Jul 10 '07 #4

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

Similar topics

11
2767
by: csomberg | last post by:
SQL 2000 I thought I would throw this out there for some feedback from others. I'd like to know if you feel using MS auto-increment field is a good solution these days or should one grow their...
21
14879
by: deepak | last post by:
hi folks I have a pointer to a file. If i increment the pointer, where will it point. I could not find the problem in the FAQs. Thanks in advance Deepak garg
1
2816
by: pooja | last post by:
Hi I m pooja.I m working on a prj in C. I m unable to increment a char pointer in a file, it gives the same address as that of the first char.Eg if # is on loc 3000 then i,n ,c ,l,u,d,e are on...
15
2657
by: ranjeet.gupta | last post by:
Dear All, Which is correct ? Let suppose we allocate the memory for the 100 bytes, int *PtrMemoryBlock = (int *)malloc(100); If I do
0
3910
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
14
1999
by: Robben | last post by:
Hi All, I have an integer pointer with value 10, but it returns a different return value after the preincrement and post increment. I will be very thankful if somebody can give an explanation...
5
13270
by: Stuart | last post by:
Hi all, Iv'e got a page that has a mass amount of input fields, all of which require a decimal figure. To make it easier when it comes to inputting data, I'm trying to setup + and - links that...
2
2270
by: braton | last post by:
Hello I'm wondering about the following thing: Let's define variable and set a pointer to points to it: int a = 0; int * p_a = &a; Now, according to C99, clause 6.5.6.7 I can treat...
1
1601
by: Studiotyphoon | last post by:
HI, I have two tables which currently have Autonumber fields which are used to create a unique number to identify an invoice for each table. Instead of having two unique numbers I'm after only...
0
7137
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
7347
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
7416
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
7073
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...
1
5062
isladogs
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...
0
4732
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...
0
3218
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...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.