flat assembler
Message board for the users of flat assembler.

Index > Linux > CRLF in generated file

Author
Thread Post new topic Reply to topic
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 14 Sep 2008, 14:37
Hello alltogether!

My question is:
I 'm coding a program, which generates itself a *.html-file.
Normally, under Linux, a CRLF is done, by a "db 10" char, right?
But, if my generated *.html-files should be usable under both, Linux and Windows, I will have to use sth like "db 13,10". Is this correct?

Maybe better understandable...
Example 1:
Code:
msg1 db '<html>',10,'<head>',10,'<title>    

or Example 2:
Code:
msg1 db '<html>',13,10,'<head>',13,10,'<title>    


Which would be the right way, for getting readable and editable *.html-Files?
I hope someone understands my problem. Smile
[/quote]
Post 14 Sep 2008, 14:37
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 14 Sep 2008, 14:41
Sure, CR-LF is pretty standard in Windows.

Although a lot of editors today can also cope with just LF without any problem. Some of the better editors also support the MAC style CR and can save-as any of the Windows/*nix/MAC formats that you choose.
Post 14 Sep 2008, 14:41
View user's profile Send private message Visit poster's website Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 14 Sep 2008, 14:44
Thx for the ultrafast answer! Smile

So, Example 2 of my first post is the right syntax?
Post 14 Sep 2008, 14:44
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 14 Sep 2008, 14:46
I think there is no right syntax. My point was that is depends upon what OS and what editing tools you are using.
Post 14 Sep 2008, 14:46
View user's profile Send private message Visit poster's website Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 14 Sep 2008, 15:15
Most likely, the files will be viewed/edited on Windows, and most likely in Notepad. Therefor, I think, the 13,10-thing will be good.
So, I hope, I can handle my other coding-problems on myself... I hope... Smile
Post 14 Sep 2008, 15:15
View user's profile Send private message Visit poster's website Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 16 Sep 2008, 18:15
There seems to be another problem in this "project"...
I want my asm-prog to create a html-file. The necessary html-sourcecode is stored in certain variables,
for example:
Quote:

msg1 db '<html><head><title>Slide-Hacker by Andy</title></head>',13,10,'<body bgcolor="#000000" text="#eeeeee">',13,10,'<center>',13,10,'<font face="Comic Sans MS"><font size=3>Bild '
size1 = $-msg1

As U can see, the line is very long, and therefor, the html-source is not good to read, for the case, I want to change it.
Can I split the variable in more lines, while it will still be ONE variable?
Post 16 Sep 2008, 18:15
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 16 Sep 2008, 18:19
Use a backslash:
Code:
msg1 db '<html><head><title>Slide-Hacker by Andy</title></head>',13,10,\
     '<body bgcolor="#000000" text="#eeeeee">',13,10,'<center>',13,10,\
     '<font face="Comic Sans MS"><font size=3>Bild '
size1 = $-msg1    
Post 16 Sep 2008, 18:19
View user's profile Send private message Visit poster's website Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 16 Sep 2008, 18:24
Ok, that's it! Smile
Thanks man, U'r my alltime-saviour! Wink
Post 16 Sep 2008, 18:24
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 16 Sep 2008, 18:49
Should I move this thread to Main?
Post 16 Sep 2008, 18:49
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 18 Sep 2008, 18:04
Another little problem (and maybe the proof, that this is right in Linux thread Wink

I have this
Quote:

mov eax, 3
mov ebx, 0
mov ecx, str
mov edx, 3
int 128

str db 0


...but fasm says "error: invalid operand."
Google and any search function didn't help me.
Maybe U can?

I just want to input a number between 0 and 999.
Post 18 Sep 2008, 18:04
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 18 Sep 2008, 18:38
STR—Store Task Register

So "mov ecx, str" is like "mov ecx, xor", you have to use a different name for the string (note that fasm rejects "str db 0" also because again, it is like defining "mov db 0").

[edit]And if you want a 3 bytes input buffer then you need "string rb 3".
Post 18 Sep 2008, 18:38
View user's profile Send private message Reply with quote
andyz74



Joined: 26 Nov 2007
Posts: 36
Location: Germany
andyz74 18 Sep 2008, 18:50
OK, that was a silly fault by me, but now it works.
Just the last task to use the given number by input as variable in repeating (don't know the english word...) and in the same time as output-string and in the same time as part of a filename.

But that's my task for tomorrow!
So thanks for the answer! Smile
Post 18 Sep 2008, 18:50
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.