Sponsored Content
Full Discussion: fwrite in Linux and UNIX
Top Forums Programming fwrite in Linux and UNIX Post 302224091 by rkraj on Tuesday 12th of August 2008 08:02:25 AM
Old 08-12-2008
Here is my program

#include<stdio.h>
#include<string.h>
struct cross_output_entry
{
char stub_descr[80];
int sort_stub_route;
double arr[20];
};
struct cross_output_type
{
union
{
char rec[8088];
struct cross_output_entry rec2;
};
};

struct cross_output_type cross;
int main()
{
int i;
FILE* fptr;
fptr=fopen("temp.text","wb");
for(i=0;i<5;i++)
{

strcpy(cross.rec2.stub_descr,"122");
cross.rec2.arr[0]=1.0;
cross.rec2.arr[1]=343.1019;
cross.rec2.arr[2]=1000.199;
cross.rec2.arr[3]=0.0;
fwrite( &cross.rec2,
sizeof(struct cross_output_type),
1,
fptr);
}
fclose(fptr);
}


The file temp.text produced in UNIX and LInux has different checksums.
Please help me to get the same check sum as i am involving myself to port application from UNIX to Linux.

Regards
rkraj
 

10 More Discussions You Might Find Interesting

1. Programming

fwrite takes extremely long time

After my previous thread, I think I found out what causes the long delays. I run this program on several Linux computers, and the sometimes (after the file with the arrays becomes big) the fwrite takes between 100 ms to 900 ms. This is very bad for me, as I want a timer to halt each 30 ms.... ... (5 Replies)
Discussion started by: inna
5 Replies

2. Programming

Help -fwrite consuming lot of memory !!!

Hi , I am running a C/C++ program on a solaris 5.8 machine. This parituclar application has a module which saves data to a file. The module uses fwrite() function to save data. The fwrite function write about 500 MB of data to a file. The problem which I am facing is, the memory consumtion... (2 Replies)
Discussion started by: ajphaj
2 Replies

3. Programming

fwrite throws segmentation fault

Code : function sSaveTFFile ....................... iRetCode = link (caCurrentFilename, caBackupFilename); if (iRetCode == -1) { ERR_MSG2(LOG_ALERT, "Can't move %s to %s", caCurrentFilename, caBackupFilename); return(FAILURE); } iRetCode = unlink... (6 Replies)
Discussion started by: fermisoft
6 Replies

4. Programming

segmentation fault in fwrite function

Hi, my code is written in proC and it is in UNIX(AIX).I have written a small code for writing data into a binary file,but while writing my program is giving core dump. Here Is my code---- fpWriteFile = fopen(WriteFileName,"wb+"); CHAR *recvgen; recvgen = (char... (7 Replies)
Discussion started by: ajaysahoo
7 Replies

5. Programming

What happens fwrite/fread at the same time?

Hello, I have a question about what happens when I copy the file which is being written by another process on Solaris 9/SPARC, UFS file system. in particular, I want to know what happens while some process is reading the file using fread or mmap, another process try to write something on the... (4 Replies)
Discussion started by: wipe3out
4 Replies

6. Programming

The fwrite function is not returning error, if the file was removed.

The fwrite function call is not returning error, when the file it writes to is removed, please advise on how to find if the file already opened and being written by a program is removed manually or by some other process. please see the code below, #include<stdio.h> #include<stdlib.h> ... (3 Replies)
Discussion started by: Kesavan
3 Replies

7. Fedora

Which is the better platform to learn UNIX/Linux (Kali Linux Vs. Red Hat or other)?

I just started a new semester and I started my UNIX class yesterday. I've already decided to use python along with my learning process but what I really want to use with it is Kali as my UNIX/Linux platform to learn off of since I already wanted to learn Cyber Sec. anyways. I just wanted to know if... (12 Replies)
Discussion started by: ApacheOmega
12 Replies

8. UNIX for Dummies Questions & Answers

Shell equivalent of matlab fwrite function

I have some matlab code that sends the serial port elements of an array using matlab's fwrite function, e.g.: fwrite(s, , 'uchar'); What would be a unix shell equivalent? E.g., after successfully accessing the port using instructions here: Simple terminal serial port program for Linux/MacOSX... (3 Replies)
Discussion started by: darwin_886
3 Replies

9. Post Here to Contact Site Administrators and Moderators

VIP Membership - The UNIX and Linux Forums - Get Your UNIX.COM Email Address Here

We work hard to make The UNIX and Linux Forums one of the best UNIX and Linux knowledge sources on the net. The site is certainly one of the top UNIX and Linux Q&A sites on the web. In order to provide certain members the best quality account services, you can now get some great extra features by... (2 Replies)
Discussion started by: Neo
2 Replies

10. What is on Your Mind?

YouTube: Forum Moderation @UNIX.com | The UNIX and Linux Forums

Forum Moderation @UNIX.com | The UNIX and Linux Forums https://youtu.be/WGwgibE4Rq0 Also note: In the video I mentioned removing legacy menu items in the ModCP which are unused. I have already "CSS'ed out" the unused menu items: ... (0 Replies)
Discussion started by: Neo
0 Replies
MMROFF(1)						      General Commands Manual							 MMROFF(1)

NAME
mmroff - cross reference preprocessor SYNOPSIS
mmroff [ -x ] groff_arguments DESCRIPTION
mmroff is a simple preprocessor for groff, it is used for expanding cross references in mm, see groff_mm(7). groff is executed twice, first with -z and -rRef=1 to collect all cross references and then to do the real processing when the cross reference file is up to date. -x Just create the cross reference file. This can be used to refresh the cross reference file, it isn't always needed to have accurate cross references and by using this option groff will only be run once. AUTHOR
Jorgen Hagg, Lund, Sweden <jh@axis.se>. FILES
/usr/share/groff/1.22.2/tmac/m.tmac /usr/share/groff/1.22.2/tmac/mm/*.cov /usr/share/groff/1.22.2/tmac/mm/*.MT /usr/share/groff/1.22.2/tmac/mm/locale SEE ALSO
groff_mm(7), groff_mmse(7), groff(1), troff(1), tbl(1), pic(1), eqn(1) Groff Version 1.22.2 9 June 2014 MMROFF(1)
All times are GMT -4. The time now is 04:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy