WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT # 
Author Message
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

If you are going to FTP it *FROM* a PC, the FTP process will put that in
for you.

It automatically (From personal experience) put the UNIX stuff in and
takes the PC stuff out (and vice versa when going from a UNIX box to a
PC) when sending.

If you are NOT FTPing from a PC to a UNIX box, I am not sure.

Quote:

> I am creating a ascii file using VB PRINT# command which will be FTP'ed to
> a UNIX file.
> Unix does not like the default CRLF and the end of each 'record' or 'line'.
>  Does anyone know how to do this with VB? I have found some C code but


--

    The views expressed herein are not necessarily that of IBMs
    but are of my own.

            ________   ___   ____
           / __   __| / _ \ |  _ \
     ______> \ | |   |  _  ||    /_____________________________
    / _______/ |_|   |_| |_||_|\______________________________ \
   / /                                                        \ \
  | |                                                          | |
  | | Chris Anderson                 AIX Product Test          | |

  | | VM : CDA at AUSVM6             RISC System/6000 Division | |
  | | 512-828-0227 / T/L 678-0227    Austin, Texas             | |
  | |                                                          | |
   \ \____________________________    _   ___   ____   _______/ /
    \___________________________  |  | | / _ \ |  _ \ / _______/
                                | |/\| ||  _  ||    /_> \        
                                 \_/\_/ |_| |_||_|\_____/



Sat, 01 Apr 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #


Quote:
>I am creating a ascii file using VB PRINT# command which will be FTP'ed to
>a UNIX file.
>Unix does not like the default CRLF and the end of each 'record' or 'line'.
> Does anyone know how to do this with VB? I have found some C code but


Instead of doing Print #file, "....text here....", try

    Print #file, "....text here...." & vbLF;

The vbLF constant gives you the UNIX line feed you want, and the final
semicolon prevents VB from adding a CRLF at the end of the line.

Alternatively, if your file is just plain ol' ASCII text, then FTPing
it to a UNIX system with the transfer mode set to ASCII instead of
binary should strip out the CRLFs and replace them with UNIX line feeds.

--



Sun, 02 Apr 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

I am creating a ascii file using VB PRINT# command which will be FTP'ed to
a UNIX file.    
Unix does not like the default CRLF and the end of each 'record' or 'line'.
 Does anyone know how to do this with VB? I have found some C code but



Sun, 02 Apr 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

Quote:

> I am creating a ascii file using VB PRINT# command which will be FTP'ed to
> a UNIX file.
> Unix does not like the default CRLF and the end of each 'record' or 'line'.
>  Does anyone know how to do this with VB? I have found some C code but


I really wouldn't worry about it. In the *n*x environment it takes
virtually no effort to strip out the extraneous CR bytes as it merely
needs to be bunged through a "tr -d '\015'", or "col -b". The sort of
thing you do with your eyes shut.

The problem is the other way round as *n*x folk have the slightly
more difficult task of *inserting* a CR before each LF if they want
to make it easy for folk on PCs. Such 'line end' problems (Mac=CR,
PC=CRLF,Unix=LF) have been around for yonks and have been solved for
yonks minus epsilon.

--
Paul Sampson____Principal Consultant Onyx Systems______Onyx Internet
Zetland Buildings__Exchange Square__Middlesbrough__TS1 1DE__UK 33711 \\/+

BB 74 A4 EF 03 F8 44 C1 F3 75 FE C6 7E F9 6E 43  http://www.onyx.net >--<



Sun, 02 Apr 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #


Quote:
>I am creating a ascii file using VB PRINT# command which will be FTP'ed to
>a UNIX file.
>Unix does not like the default CRLF and the end of each 'record' or 'line'.
> Does anyone know how to do this with VB? I have found some C code but


Try

print #1, somestring + vbLF;

the ";" will stop VB adding a CRLF and the vbLF constant adds the required
Unix LF line termination character.

I thought that the FTP protocol was supposed to handle line termination
conversion if files are sent as ASC type not BIN.

David Kane



Sun, 02 Apr 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

Try using PUT instead of PRINT. PUT will output binary and exactly what you
tell it with no extraneous info.



Quote:
> I am creating a ascii file using VB PRINT# command which will be FTP'ed
to
> a UNIX file.      
> Unix does not like the default CRLF and the end of each 'record' or
'line'.
>  Does anyone know how to do this with VB? I have found some C code but
> would like to stick with VB.  Thanks! James Marlin  




Sat, 05 Aug 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #


Quote:
>Try using PUT instead of PRINT. PUT will output binary and exactly what you
>tell it with no extraneous info.



>> I am creating a ascii file using VB PRINT# command which will be FTP'ed
>to
>> a UNIX file.  
>> Unix does not like the default CRLF and the end of each 'record' or
>'line'.
>>  Does anyone know how to do this with VB? I have found some C code but
>> would like to stick with VB.  Thanks! James Marlin  


If all else fails, man dtox on the UNIX box.


Thu, 10 Aug 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

ftp has an option (cr) to strip CR's off each line of an ASCII file as
it transfers.  Check the man page on ftp.


: >Try using PUT instead of PRINT. PUT will output binary and exactly what you
: >tell it with no extraneous info.
: >


: >> I am creating a ascii file using VB PRINT# command which will be FTP'ed
: >to
: >> a UNIX file.
: >> Unix does not like the default CRLF and the end of each 'record' or
: >'line'.
: >>  Does anyone know how to do this with VB? I have found some C code but
: >> would like to stick with VB.  Thanks! James Marlin  

: >>
: >>

: If all else fails, man dtox on the UNIX box.



Fri, 11 Aug 2000 03:00:00 GMT  
 WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #



Quote:
> I am creating a ascii file using VB PRINT# command which will be FTP'ed to
> a UNIX file.
> Unix does not like the default CRLF and the end of each 'record' or

'line'.


Quote:

>Try using PUT instead of PRINT. PUT will output binary and exactly what you
>tell it with no extraneous info.

You can also put at the end of every PRINT# that doesn't already end with a
semicolon
the sequence "; vbLf;". For example:
    Print #1, "PAOLO", "BONZINI"
becomes
    Print #1, "PAOLO", "BONZINI"; vbLf;  ' last semicolon is very important!

Cheers...

 _ _
(_|_)  Paolo Bonzini



Wed, 16 Aug 2000 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

2. WINDOWS to UNIX file creation with VB 5 CRLF to LF using PRINT #

3. Fast way to convert CR or LF files to CRLF

4. Access 97 and Importing a UNIX file (no CRLF)

5. Code Snippet: LF to CRLF

6. Read file with LF instead of CR+LF

7. Connecting oracle ( Unix server ) from windows mc using vb

8. How to view the files printed by VB using print to file

9. Automated Account Creation on Windows NT4.0 Using VB 5.0

10. Automated Account Creation on Windows NT4.0 Using VB 5.0

11. Urgent, using VB to run files in unix server

12. Printing .tif files on Win NT using Windows API

 

 
Powered by phpBB® Forum Software