|
-
November 4th, 1999, 01:04 PM
#1
Unix Ascii Text importing
I am trying to import an ascii text files that is created on a Unix machine. I was wondering if anyone knows how to deal with these file types. The problem that I am having is with the Unix text file because it only end with a carriage return and not with a carriage return and Line Feed. I have tried searching for the carriage return in the file chr(13) but it will not find it.
If anyone has had luck dealing with this in the past any help would be appreciated.
Thanks in advance
Sean Gearin
[email protected]
-
November 4th, 1999, 05:00 PM
#2
Re: Unix Ascii Text importing
I just checked on a unix box sitting next to me and the lines end with Chr(10). Not a Chr(13) in sight! :-)
It is often possible to enable translation when transfering a file from UNIX. For example, ftp will usually do the translation for you.
I don't know the details, but it may be worth looking into.
Roger
-
November 5th, 1999, 07:46 AM
#3
Re: Unix Ascii Text importing
Copy the file one byte at time, as you find
chr(10) write chr(13) followed by chr(10).
-
November 5th, 1999, 07:57 PM
#4
Re: Unix Ascii Text importing
use something like this on the entire file:
strString = Replace(strString, vbLf)
-
November 5th, 1999, 09:49 PM
#5
Re: Unix Ascii Text importing
Nah, Too slow on large files... I'd do it in C.
int c;
while (c = fgetc(in) != EOF) {
if (c = 0x0A)
fputc(0x0D, out);
fputc(c, out);
}
Will run 100 times faster than same in VB. :-)
Please don't throw anything harder than a wrotten tomato!
The Devils Advocate
-
November 6th, 1999, 03:08 AM
#6
Re: Unix Ascii Text importing
I didnt say write it in VB.
You should make the following changes:
int c;
while ((c = fgetc(in)) != EOF) {
if (c == 0x0A)
fputc(0x0D, out);
fputc(c, out);
}
-
November 8th, 1999, 09:58 AM
#7
Re: Unix Ascii Text importing
Ah, you busted me... two mistakes! I was just making fun anyway, that's why I added the comment about tomatos... so don't take it too seriously...
Welp, I think I've taken us about as far off topic as good taste permits. I suggest we take any further discussion on C to private mail. :-)
Have a good day,
Roger
-
November 8th, 1999, 10:23 AM
#8
Re: Unix Ascii Text importing(the end)
You've been nice 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|