Sponsored Content
Full Discussion: Binary file
Top Forums Programming Binary file Post 302318233 by joshighanshyam on Thursday 21st of May 2009 06:03:53 AM
Old 05-21-2009
Binary file

Hi all
I have a C program to write it's output into a textfile which is also created by the program in between. The file that's get created prompt's a message while opening manually that the file is binary and any change in that leads to it's corruption.

I have used putc() to write the output to file.
I have also detected if i simply used the fopen() with file name (option "b" is not used) and then simply closed it using fclose() then a plaintext file get created which does not display above message.

The program is giving plain text file in windows which is expected.
How can i avoid the creation of binary file..?

Thanks in advance
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

binary file

please let me know how can i mail the binary files is it can be done thru pine? is there any other way to do it? wat are the changes in system i have to make and one more thing i am sending data to a message queue and then retriving the data from the queue but when i do the ipcs... (1 Reply)
Discussion started by: ramneek
1 Replies

2. Solaris

compiled binary file gives "cannot execute binary file"

Hi, I have two Solaris machines. 1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500 2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60 I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Discussion started by: scgupta
0 Replies

3. Shell Programming and Scripting

dd - binary file

I have a task that says: make a file (called binaryfile ) that contains 4 bytes of NULL data 6 bytes of random data 8 bytes of 1 10 bytes of 5 and 12 bytes of 9. For the first 2, I can used : dd if=/dev/null of=binaryfile bs=8 count =4 and dd if=/dev/urandom of=binaryfile bs=8... (3 Replies)
Discussion started by: spiriad
3 Replies

4. UNIX for Dummies Questions & Answers

Binary file

How can we see the contents of a binary file? (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

5. Shell Programming and Scripting

To log binary file output to a txt file

Hi, I wrote a small script whose function is to execute the postemsg provided if the threshold breaches. I want to log this postemsg messages to a log file. But I am not able to do. Can someone throw some light on how to log the output of this. I am pasting a snippet of that code. ... (2 Replies)
Discussion started by: dbashyam
2 Replies

6. UNIX for Dummies Questions & Answers

Pipe binary file matches grep results to file

I am using grep to match a pattern, but the output is strange. $ grep -r -o "pattern" * Gives me: Binary file foo1 matches Binary file foo2 matches Binary file foo3 matches To find the lines before/after, I then have to use the following on each file: $ strings foo1 | grep -A1 -B1... (0 Replies)
Discussion started by: chipperuga
0 Replies

7. UNIX for Advanced & Expert Users

How to copy a binary file while the file is being written to by another process

Hello, Can I copy a binary file while the file is being written to by another process? Another process (program) “P1” creates and opens (for writing) binary file “ABC” on local disk. Process P1 continuously write into ABC file every couple of seconds, adding 512-byte blocks of data. ABC file... (1 Reply)
Discussion started by: mbuki
1 Replies

8. Shell Programming and Scripting

Output redirection of c binary file to a file in shell script is failing

I am struck up with a problem and that is with output redirection. I used all the ways for the redirection of the output of c binary to a file, still it is failing. Here are the different ways which I have used: ./a.out | tee -a /root/tmp.txt 2>&1 ./a.out | tee -a /root/tmp.txt 1>&1 ./a.out |... (2 Replies)
Discussion started by: Maya29988
2 Replies

9. UNIX for Dummies Questions & Answers

[AIX] Binary file warning for text file.

Hello guys, We had to move from a DC to another, and we are now facing an "issue" with some text files. Looks like that some of our log files are set as binary: file TuxConnectorURA.20121012 TuxConnectorURA.20121012: data or International Language text less TuxConnectorURA.20121012... (2 Replies)
Discussion started by: EnioMarques
2 Replies

10. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies
PASSWORD-PROMPT(8mandos)					   Mandos Manual					  PASSWORD-PROMPT(8mandos)

NAME
password-prompt - Prompt for a password and output it. SYNOPSIS
password-prompt [--prefix PREFIX | -p PREFIX] [--debug] password-prompt {--help | -?} password-prompt --usage password-prompt {--version | -V} DESCRIPTION
All password-prompt does is prompt for a password and output any given password to standard output. This program is not very useful on its own. This program is really meant to run as a plugin in the Mandos client-side system, where it is used as a fallback and alternative to retrieving passwords from a Mandos server. This program is little more than a getpass(3) wrapper, although actual use of that function is not guaranteed or implied. OPTIONS
This program is commonly not invoked from the command line; it is normally started by the Mandos plugin runner, see plugin-runner(8mandos). Any command line options this program accepts are therefore normally provided by the plugin runner, and not directly. --prefix=PREFIX, -p PREFIX Prefix string shown before the password prompt. --debug Enable debug mode. This will enable a lot of output to standard error about what the program is doing. The program will still perform all other functions normally. --help, -? Gives a help message about options and their meanings. --usage Gives a short usage message. --version, -V Prints the program version. EXIT STATUS
If exit status is 0, the output from the program is the password as it was read. Otherwise, if exit status is other than 0, the program has encountered an error, and any output so far could be corrupt and/or truncated, and should therefore be ignored. ENVIRONMENT
CRYPTTAB_SOURCE, CRYPTTAB_NAME If set, these environment variables will be assumed to contain the source device name and the target device mapper name, respectively, and will be shown as part of the prompt. These variables will normally be inherited from plugin-runner(8mandos), which will normally have inherited them from /scripts/local-top/cryptroot in the initial RAM disk environment, which will have set them from parsing kernel arguments and /conf/conf.d/cryptroot (also in the initial RAM disk environment), which in turn will have been created when the initial RAM disk image was created by /usr/share/initramfs-tools/hooks/cryptroot, by extracting the information of the root file system from /etc/crypttab. This behavior is meant to exactly mirror the behavior of askpass, the default password prompter. BUGS
None are known at this time. EXAMPLE
Note that normally, command line options will not be given directly, but via options for the Mandos plugin-runner(8mandos). Normal invocation needs no options: password-prompt Show a prefix before the prompt; in this case, a host name. It might be useful to be reminded of which host needs a password, in case of KVM switches, etc. password-prompt --prefix=host.example.org: Run in debug mode. password-prompt --debug SECURITY
On its own, this program is very simple, and does not exactly present any security risks. The one thing that could be considered worthy of note is this: This program is meant to be run by plugin-runner(8mandos), and will, when run standalone, outside, in a normal environment, immediately output on its standard output any presumably secret password it just received. Therefore, when running this program standalone (which should never normally be done), take care not to type in any real secret password by force of habit, since it would then immediately be shown as output. To further alleviate any risk of being locked out of a system, the plugin-runner(8mandos) has a fallback mode which does the same thing as this program, only with less features. SEE ALSO
intro(8mandos) crypttab(5) mandos-client(8mandos) plugin-runner(8mandos), COPYRIGHT
Copyright (C) 2008-2009, 2011-2012 Teddy Hogeborn, Bjorn Pahlsson This manual page is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This manual page is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. Mandos 1.5.5 2012-01-01 PASSWORD-PROMPT(8mandos)
All times are GMT -4. The time now is 02:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy