Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Writing to a file, will not create new line.
« previous next »
  • Print
Pages: [1]

Author Topic: Writing to a file, will not create new line.  (Read 4304 times)

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Writing to a file, will not create new line.
« on: October 08, 2006, 12:19:16 AM »
I know it doesnt seem like this belongs here, but is there a way to do this using code? I have no idea how, (or if changing the encoding type changes anything)

would making a different font change anything?

thanks for any help or info

EDIT: Subject change
« Last Edit: October 16, 2006, 06:41:09 PM by Jazz00006 »
Logged
Whats that got to do with the price of feet?

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Showing non-default characters
« Reply #1 on: October 08, 2006, 12:23:59 AM »
I think you should maybe clarify further what you're trying to do. I don't exactly know what you're asking.
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Showing non-default characters
« Reply #2 on: October 08, 2006, 02:00:46 AM »
well, some characters, such as É or ü, do not show up when viewing them through the viewer or a print function in code.

is there anyway to make ALL of them show, or is this not possible yet.
and as above, is this possible through code? or will i have to make my own font to make them show
Logged
Whats that got to do with the price of feet?

Offline Llorean

  • Member
  • *
  • Posts: 12931
Re: Showing non-default characters
« Reply #3 on: October 08, 2006, 02:13:07 AM »
They should show up as long as you're using a font that supports them. For example, have you tried Unifont?
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Showing non-default characters
« Reply #4 on: October 08, 2006, 02:18:47 AM »
Thanks, i will give it a try, i will post back with my results ^.^
Logged
Whats that got to do with the price of feet?

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Showing non-default characters
« Reply #5 on: October 08, 2006, 10:43:28 PM »
i have tried using code

rb->lcd_setfont("Unifont");

or other similar ones, rb->lcd_setfont(Unifont); , rb->lcd_setfont(Font_Unifont);

but it gives me a small error, any ideas on this?
Logged
Whats that got to do with the price of feet?

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Showing non-default characters
« Reply #6 on: October 14, 2006, 04:30:26 AM »
^^ dont worry about the above, new question

how would i write to a file, but with each write, make a new line? (I am only having trouble with the new line part)


In my file i have something similar to

Code: [Select]
fd = rb->open(Temp_Data,O_RDWR | O_CREAT);

while(rb->read_line(file,buffer1,100) != NULL)
{
   char* pos =  rb->strcasestr(buffer1,word);
   if(pos != 0)    
   {
        rb->fdprintf(fd, buffer1, sizeof(buffer1));
rb->yield();
   }
}


rb->close(fd);

but with every time it does a search and write it only writes continusly, no gaps or spaces, only continous words.


Any help will be greatly apreciated, thankyou
Logged
Whats that got to do with the price of feet?

Offline bluebrother

  • Developer
  • Member
  • *
  • Posts: 3487
  • creature
Re: Showing non-default characters
« Reply #7 on: October 14, 2006, 07:26:55 AM »
Quote from: Jazz00006 on October 14, 2006, 04:30:26 AM
Code: [Select]
fd = rb->open(Temp_Data,O_RDWR | O_CREAT);

while(rb->read_line(file,buffer1,100) != NULL)
{
   char* pos =  rb->strcasestr(buffer1,word);
   if(pos != 0)   
   {
        rb->fdprintf(fd, buffer1, sizeof(buffer1));
rb->yield();
   }
}


rb->close(fd);

fdprintf prints a formatted text, so you need a formatter string. Why don't you use write instead?
Code: [Select]
rb->write(fd, buffer, sizeof(buffer));
should do it. You may also want to write only the amount of bytes read by read_line.
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Showing non-default characters
« Reply #8 on: October 15, 2006, 07:01:26 PM »
nope, that still gives me continous text,
heres a sample of what i get from it.

#!Translate Output File###Searching for: window                                                                              ###==Begin File==# window: Fenster ühlen )  raße (f) ve]  - igkeit ie Kühe nach Hause kommen ..) ] ichkeit[Noun]        window: Fenster (n) n )  raße (f) ve]  - igkeit ie Kühe nach Hause kommen ..) ] ichkeit[Noun]        window glass: Fensterglas (n) (f) ve]

heres what i would like to see

#!Translate Output File#
#
#Searching for: window
#
#==Begin File==#
window: Fenster ühlen
window: Fenster (n)
window glass: Fensterglas (n) (f)


I understand some things are my fault, but the new line part isnt.

thanks for any help you wish to give
Logged
Whats that got to do with the price of feet?

Offline bluebrother

  • Developer
  • Member
  • *
  • Posts: 3487
  • creature
Re: Showing non-default characters
« Reply #9 on: October 16, 2006, 06:19:30 PM »
Quote from: Jazz00006 on October 15, 2006, 07:01:26 PM
nope, that still gives me continous text,
heres a sample of what i get from it.
You are using read_line. From the comments of the read_line function (in apps/misc.c) you can find that all line ending characters are stripped. So you either need to read the lines a different way or add a line ending character after each line you wrote.
Logged

Offline Jazz00006

  • Member
  • *
  • Posts: 40
  • Master Jin
Re: Showing non-default characters
« Reply #10 on: October 16, 2006, 06:26:31 PM »
Quote from: bluebrother on October 16, 2006, 06:19:30 PM
Quote from: Jazz00006 on October 15, 2006, 07:01:26 PM
nope, that still gives me continous text,
heres a sample of what i get from it.
You are using read_line. From the comments of the read_line function (in apps/misc.c) you can find that all line ending characters are stripped. So you either need to read the lines a different way or add a line ending character after each line you wrote.

I think i understand what you mean, so...

how would i add a line ending char to each line i write then?
Logged
Whats that got to do with the price of feet?

Offline LinusN

  • Member
  • *
  • Posts: 1914
Re: Writing to a file, will not create new line.
« Reply #11 on: October 17, 2006, 03:17:49 AM »
Use fdprintf() and add the newline to the format string:

Code: [Select]
rb->fdprintf(fd, "%s\n", buffer);
Logged
Archos Jukebox 6000, Recorder, FM Recorder/iAudio X5/iriver H1x0, H3x0/Toshiba Gigabeat F20/iPod G5, G5.5

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Writing to a file, will not create new line.
 

  • SMF 2.0.18 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.606 seconds with 21 queries.