473,854 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOS/UNIX/MAC files

I would like to know how I can check, prior to opening a textfile, for
DOS/UNIX/MAC formatting of the file. Is there a way to do this, or is it
impossible?

Thx, CoRrRan
Apr 23 '07 #1
4 2061
CoRrRan wrote:
I would like to know how I can check, prior to opening a textfile, for
DOS/UNIX/MAC formatting of the file. Is there a way to do this, or is it
impossible?
The best you can do is to take an "educated guess" based on the
line-breaks that you find in the file ...

Cr Mac (I think)
Lf Unix
Cr Lf Windows

.... but it /is/ only a guess. There's /no/ guarantee that you won't
find, say, Lf-delimited files on a Windows machine.

HTH,
Phill W.
Apr 23 '07 #2
Hey Phill,

Yes, I do realize I can do that, but I KNOW I will encounter both UNIX
and DOS formatted text files. I know UltraEdit somehow knows what kind
of file I'm trying to load, and consequently asks me to convert it. I
guess it somehow is able to check for file formatting, but perhaps it
does it in a rough way and reads in part of the file prior to asking me
the conversion question. I was just hoping that somehow it is known on
the outside what kind of file I'm trying to load.

CoRrRan

Phill W. wrote:
CoRrRan wrote:
>I would like to know how I can check, prior to opening a textfile, for
DOS/UNIX/MAC formatting of the file. Is there a way to do this, or is
it impossible?

The best you can do is to take an "educated guess" based on the
line-breaks that you find in the file ...

Cr Mac (I think)
Lf Unix
Cr Lf Windows

... but it /is/ only a guess. There's /no/ guarantee that you won't
find, say, Lf-delimited files on a Windows machine.

HTH,
Phill W.
Apr 23 '07 #3
"CoRrRan" <CoRrRan~NOSPAM ~@~NOSPAM~gmail .comschrieb:
Yes, I do realize I can do that, but I KNOW I will encounter both UNIX and
DOS formatted text files. I know UltraEdit somehow knows what kind of file
I'm trying to load, and consequently asks me to convert it. I guess it
somehow is able to check for file formatting, but perhaps it does it in a
rough way and reads in part of the file prior to asking me the conversion
question.
Yes, the decision is made on some (statistical) analysis of a part of the
file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Apr 23 '07 #4
Ah, so it does 'cheat'. :-) I guess I'll have to think of something similar.

Thanks for answering Herfried!

CoRrRan

Herfried K. Wagner [MVP] wrote:
"CoRrRan" <CoRrRan~NOSPAM ~@~NOSPAM~gmail .comschrieb:
>Yes, I do realize I can do that, but I KNOW I will encounter both UNIX
and DOS formatted text files. I know UltraEdit somehow knows what kind
of file I'm trying to load, and consequently asks me to convert it. I
guess it somehow is able to check for file formatting, but perhaps it
does it in a rough way and reads in part of the file prior to asking
me the conversion question.

Yes, the decision is made on some (statistical) analysis of a part of
the file.
Apr 24 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2731
by: Alex | last post by:
I've just noticed that directories in Unix have different sizes whereas in Windows they don't. Why is this so? Thanks. Alex.
3
2612
by: Jay O'Connor | last post by:
I'm doing some Python CGI programming under Windows (Win95) but my CGIs need to run on Linux. If I try to write and save the files in IDLE, they get saved in DOS format and won't run on the Linux server. If I load the files into another text editor and explictely "Save As" in UNIX format, they work fine, but the other editor is not Python aware so I'd rather not have to use if for main development, and having to load and resave my scripts...
5
3549
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered
46
2550
by: dawn | last post by:
Hi all, I am now working on a C program under Unix. The requirement for the program is that: A file name is passed to program as a parameter. The program will Find files under a specified directory. The matched file must have the same content with the given file. It does not matter whether the filenames are the same. It is easy to find file that has the same name with given file, but may be hard to find the files that with the same...
1
1798
by: Nick Wain | last post by:
Hello All, I'm relatively new to PYTHON, using PYTHON 2.4 on Windows XP. I'm having a problem as below. I've asked some other people in my office who are more experienced in PYTHON, but they can't help. I have a number of files created in UNIX that have the UNIX end of line (EOL) character. I want to read these files in python, modify some lines, and then write them
7
3323
by: Adam | last post by:
Hello. I do most of my web dev work from a Mac (whose file system is case-insensitive.) I upload my web pages and other files onto a Unix-based host, which is case sensitive. When I look at the errors that were generated on my web site, I find that sometimes people are trying to access, for example, "file.exe", when I uploaded it as "File.exe" with an uppercase letter. Some of these pages and files have had mixed case for years and...
16
2953
by: mazwolfe | last post by:
Someone recently asked about reading lines. I had this code written some time ago (part of a BASIC-style interpreter based on H. Shildts in Art of C) to read a file with the lines ended in any format: Microsoft-style CR/LF pair, Unix-style NL, or Mac-style CR. It also allows for EOF that does not follow a blank line. I thought this would make text-file sharing a bit easier. Here it is: /* Load a file, normalizing newlines to *nix...
1
1825
by: Marcin Wiszowaty | last post by:
Hello, I work at a company that has 2 development enviroments. One Unix which i dont know anything about and the othe vs.net 03 with MSSQL server 2000 for db. How can i cause applications (scripts) to get run in unix while using preferably vb.net or c# applications run in windows. So far all the unix aplications are started manualy through the command window. Files are sent using FTP. We have XceedFTP client to send files to unix from...
1
4285
by: kardon33 | last post by:
Let me explain my problem, Im currently trying to use a Perl module that was built for a Windows OS that uses a .dll and .lib file. I have obtained the c header files that the modules were built with. I am trying to use SWIG to write my Perl mod with those files but I getting a bunch of errors with the "extern "C" __declspec(dllimport)" command kinda know that basics of the command, its used to declare vars from a .dll. If im wrong please...
1
3842
RRick
by: RRick | last post by:
I have a unix C++ project that needs to be converted over to windows visual studio. I'm not sure of the exact version of VS, but it's a recent version, probabIy 2003 or 2005. I would like the windows directory tree to mimic the unix tree as closely as possible, but I don't want duplicate files and other inconsistencies. I have come up with an idea but I don't know how close it fits a "typical" windows project. If you know of specific...
0
9751
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10678
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7914
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4153
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.