06-13-2005
Either you're tranferring the file in binary mode rather than ascii mode or you can try using this to fix your problem (sorry I'm a PHP man and don't know a better way off-hand).
Save the following as "unix2dos" filename
------------------------------------
PHP Code:
#!/usr/bin/php
<?php
$in = $argv[1];
$out = $argv[2];
$unix_data = file_get_contents($in); //Read the file
$win32_data = preg_replace("#\n#", "\r\n", $unix_data); //Turn linebreaks into carriage returns
$handle = fopen($out, 'w'); //Create new file for writing
if (fwrite($handle, $win32_data)) { //Write the data to the new file
echo "\n$out created as Win32 compatible file successfully!\n";
} else {
echo "\nThere has been a problem writing data to $out...\n";
}
fclose($handle); //Close the file
?>
Then simply run:
chmod +x unix2dos
./unix2dos oldfilename.txt newfilename.txt
and voila! A dos compatible file
*d11wtq moderates devnetwork php forums btw
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Need Help?? We receive Files From GM Motors and they written on a Sun Workstation using the Tar Command on a 4mm Dat Tape. We have an HP sure Store 24 Tape drive that will Execpt but when i do that it says that the media is bad. was wondering if there was any software that would read it in its... (2 Replies)
Discussion started by: jefft1976
2 Replies
2. Shell Programming and Scripting
Hey,
I'm trying to install a java web archive on unix but all the jsp's are in windows text format. I need to convert them all to unix text at once but I really don't want to do that on a file per file basis so I need to loop over all text files in all subdirectories and change the ^M. Does... (4 Replies)
Discussion started by: rein
4 Replies
3. Shell Programming and Scripting
Hi everyone,
If someone out there could help me out with this problem. I would really appreciate it.
I am trying to convert a file into xml format using Unix shell scripts.
The file has fields with each field having a certain number of bytes, but the fields are not delimited by anything... (10 Replies)
Discussion started by: Laud12345
10 Replies
4. Shell Programming and Scripting
Hi,
Need help on windows text file that i get in unix server and need to change and resend for process.
Now there is a ^M will be placed for each line of that file i need that to be removed .
Someone please help me.
Thanks in advance for all help. (1 Reply)
Discussion started by: pragy1999
1 Replies
5. Windows & DOS: Issues & Discussions
Hello,
I am on a WinXP home machine with a 17 MB text file and I need to change the DOS/Windows CR to a UNIX LF.
Does anyone know how I can do this or even better a WinXP program that can do this for me ?
My hobby is my Family History. I know very little about all this type stuff and I... (9 Replies)
Discussion started by: tex
9 Replies
6. Shell Programming and Scripting
hi all,
can anybody help me with script or command to ftp some text file from windows machine to AIX machine.
this is shud be done by executing a shell script. (1 Reply)
Discussion started by: suprithhr
1 Replies
7. UNIX for Dummies Questions & Answers
Hello
I am looking for advise on how to convert a windows based computer system into a UNIX based operating system.. I would like to be able to learn UNIX better than I know it and work didn't allow me to work with UNIX much.
Is there a book where I could learn how to accomplish that... (6 Replies)
Discussion started by: baksg1995
6 Replies
8. UNIX for Dummies Questions & Answers
Hi Buddies,
I have a unix client and want to send a message (containg some data) to a windows Database server to query from it and return the result.
I shall be so thankfull if you help me out.:b::)
Warm Regards,
Jessi (1 Reply)
Discussion started by: jessica-adams
1 Replies
9. Shell Programming and Scripting
Hi,
I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix.
My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies
10. What is on Your Mind?
I have an old Dell system that I would like to convert over to a Unix system and I have no idea how to do this. Where can I go to get the information to do this. This will be a secondary computer that I will learn and "play" with. I have heard that it is fairly easy to do and that once I get used... (0 Replies)
Discussion started by: Richard.Borden2
0 Replies
LEARN ABOUT CENTOS
glutsetoption
UNTITLED
LOCAL UNTITLED
NAME
glutSetOption -- Allows you to set some general state/option variables.
LIBRARY
OpenGLUT - state
SYNOPSIS
#include <openglut.h>
void
glutSetOption(GLenum eWhat, int value);
PARAMETERS
eWhat Enumerated parameter ID.
value New value.
DESCRIPTION
Stores the value into a state variable named by eWhat.
Allowable eWhat IDs are:
- GLUT_ACTION_ON_WINDOW_CLOSE
Controls what happens when a window is closed by the user or system. GLUT_ACTION_EXIT will immediately exit the application (default).
GLUT_ACTION_GLUTMAINLOOP_RETURNS will immediately return from the main loop. GLUT_ACTION_CONTINUE_EXECUTION will contine execution of
remaining windows.
- GLUT_INIT_DISPLAY_MODE
An alternate way to set the display mode for a new window.
- GLUT_INIT_WINDOW_HEIGHT
An alternate way to set the height of new windows.
- GLUT_INIT_WINDOW_WIDTH
An alternate way to set the width of new windows.
- GLUT_INIT_WINDOW_X
An alternate way to set the initial horizontal position of new windows.
- GLUT_INIT_WINDOW_Y
An alternate way to set the initial vertical position of new windows.
- GLUT_RENDERING_CONTEXT
Set to either GLUT_CREATE_NEW_CONTEXT or GUT_USE_CURRENT_CONTEXT to indicate whether to share the current OpenGL rendering context with
new windows.
- GLUT_WINDOW_CURSOR
Attempt to set the current window 's current cursor as if by glutSetCursor().
SEE ALSO
glutGet(3) glutDeviceGet(3) glutGetModifiers(3) glutLayerGet(3) glutDestroyWindow(3) glutMainLoop(3) glutInitDisplayMode(3) glutInit(3)
glutInitWindowSize(3) glutInitWindowPosition(3) glutSetCursor(3)
Epoch