Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


FileWrite at certain line..?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-11-2008, 04:18 PM
Knows the basics
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 71
Default FileWrite at certain line..?

Hello,

i'm trying to write a line to a certain position within a file.My plan was to use FileRead to get to the position i'm looking for and then FileWrite to change the content of this line.

This doesn't work, because i cannot open a file for read & write access at the same time.I saw there is also FileGet and that stuff with cRandom access but i would like to stay with line based string access and not counting bytes in the file.

How can i achieve this..?

cheers

TWELVE
Reply With Quote
  #2 (permalink)  
Old 05-11-2008, 04:31 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,318
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

The easiest way i can think off, is to read and load the whole file to a table, apend the data you want, were you want it, and them save the file again overwriting the existing one...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #3 (permalink)  
Old 05-13-2008, 06:29 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

You can open the file for reading.
Open a new file for writing.
Read each line from the original file and write it to the new file.
Add the new line when you reach its location.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Different Line Types ceaser Code Samples & Tips 4 08-20-2008 02:39 PM
Travian off-line stats... Cableguy Questions & Help Needed 3 07-25-2008 05:55 AM
Error at line 0? Mistrel Questions & Help Needed 9 11-04-2007 08:40 PM
How to draw a line? RandomCoder Questions & Help Needed 3 08-24-2007 10:11 PM
FileWrite with Danish letters æøå Lasse Questions & Help Needed 1 05-17-2007 03:55 PM


All times are GMT. The time now is 09:48 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0