Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

FileWrite at certain line..?

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-11-2008, 03:18 PM
Senior Member
 
Join Date: Apr 2008
Location: Duesseldorf, Germany
Posts: 154
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, 03:31 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
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 - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #3 (permalink)  
Old 05-13-2008, 05:29 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
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
  #4 (permalink)  
Old 08-31-2010, 10:07 AM
konisek's Avatar
Knows the basics
 
Join Date: Jan 2009
Posts: 55
Default

I would like to use FileWrite and add a string (or strings) to the first line in the file. Is there a simple way or do I have to use the way you have described before as the only one solution? (L)
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 Off
Pingbacks are Off
Refbacks are On

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


All times are GMT. The time now is 09:25 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0