Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Still struggling with File to string
Message
De
15/10/2014 12:35:42
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01609421
Message ID:
01609461
Vues:
40
>If I only put a carriaige return I get a continuous line of text - I will ask my client what he wants
>
>Thanks for ther help

Just in case it wasn't clear with the names -- think teletype or typewriter. The carriage return (CR) moves the carriage or platen to the starting position so that the next character that would be printed would start in the first column. A linefeed (LF) advances the platen one line (but doesn't reset the carriage) so that the next character that would get printed would be one line below where it would've been printed had the linefeed not been encountered. Depending on the environment, the "newline" sequence may be different. Under Unix, text files have lines terminated with LF only (I.e. there is an implied CR). In DOS/Windows the "newline" is CR followed by LF.

If you only use CR to terminate the lines, when you view the file (e.g. use TYPE at the command line in DOS/Windows, or "cat" in Unix), you'll see the lines "overprint" each other (i.e. the second line prints on top of the first, the third overprints the second, etc) -- so basically you get a jumbled mess (though this has its uses -- on teletype terminals, this was often used to blank out passwords -- a series of characters would be overstruck to create a black blob, then the carriage was moved over the blob when you typed the password -- the password would still be printed, but would be obscured on the paper by the blob). Of course if the lines are long enough to cause linewrap, the subsequent lines overprint the last line of text in the previous line.

As for what you'll see in a text editor depends on how it interprets the text. Some that work in DOS/Windows will not work correctly if you don't properly terminate the lines with CR/LF. Some may assume a "newline" at each CR and "eat" the following character (first character on second and later lines may be missing). Some may assume "newline" with each LF and "eat" the preceding character (the last character on each line may be missing). I'd seen others that would seem to work in either case -- but if you reverse the CR/LF sequence, you end up with double-spaced lines (when you TYPE the file on the screen, you may not see a difference between CR/LF and LF/CR sequence).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform