Sponsored Content
Top Forums Programming Segmentation fault in fopen when in write mode. Post 302672423 by alister on Monday 16th of July 2012 10:49:45 AM
Old 07-16-2012
Hello, shoaibjameel123:

On an unrelated note, I'm curious about something. I've noticed in your last couple of C threads that your main() prototype is using fixed-width integer types. Why are you using int32_t instead of plain int?

On a typical server or desktop system, int32_t is almost certainly a typedef (or a typedef of a typedef) of int anyway, so it doesn't cause a problem (at least until we move to 256 bit systems Smilie). All joking aside, it seems to me an unnecessarily restrictive choice.

Regards,
Alister

Last edited by alister; 07-16-2012 at 11:53 AM.. Reason: typo/grammar
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

sometimes for this code i get a segmentation fault for codes llike this : int main{ int * a= 0; int b; a = (int*)malloc(sizeof(int)); ///some code using these variable but no freeing of a if(a){ free(a); a = 0; } return... (3 Replies)
Discussion started by: wojtyla
3 Replies

2. Programming

Hi! segmentation fault

I have written a program which takes a directory as command line arguments and displays all the dir and files in it. I don't know why I have a problem with the /etc directory.It displays all the directories and files untill it reaches a sub directory called peers which is in /etc/ppp/peers.the... (4 Replies)
Discussion started by: vijlak
4 Replies

3. AIX

Segmentation fault

Hi , During execution a backup binary i get following error "Program error 11 (Segmentation fault), saving core file in '/usr/datatools" Riyaz (2 Replies)
Discussion started by: rshaikh
2 Replies

4. Programming

segmentation fault

Hi, I am having this segmentation fault not in the following program, bt. in my lab program . My lab program is horrible long so cannot post it here bt. I am using the following logic in my program which is giving the segmentation fault. Bt. if I run this sample program as it is it dosen't give... (3 Replies)
Discussion started by: mind@work
3 Replies

5. Programming

Segmentation fault.

I'm getting a segmentation fault. I'm new to Linux programming. Thanks so much for all of your input.:eek: #include </usr/include/mysql++/mysql++.h> #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> using namespace std; int outputToImport(const char*... (1 Reply)
Discussion started by: sepoto
1 Replies

6. UNIX for Dummies Questions & Answers

Segmentation fault

#include<stdio.h> #include<malloc.h> #include<unistd.h> #include<stdlib.h> void *start_1(void *argv) { printf("thread 0x%x\n",(unsigned int)pthread_self()); pthread_exit((void*)1); } void *start_2(void *argv) { printf("thread 0x%x\n",(unsigned int)pthread_self()); return (void*)2; }... (2 Replies)
Discussion started by: vincent__tse
2 Replies

7. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

8. Solaris

Segmentation fault

Hi Guys, I just installed and booted a zone called testzone. When I logged in remotely and tried changing to root user I get this error: "Segmentation fault" Can someone please help me resolve this? Thanks alot (2 Replies)
Discussion started by: cjashu
2 Replies

9. Shell Programming and Scripting

Count Segmentation fault and write to the file

Hi everyone Need to get version of npm application that have several output like this: root: nmp -version 10 root: nmp -version 10 root: nmp-new -version 3.1 root: nmp-old -version Segmentation fault count them , after that write to the file like this: 10 2 3.1 1 (1 Reply)
Discussion started by: indeed_1
1 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
types(5)							File Formats Manual							  types(5)

NAME
types - primitive system data types SYNOPSIS
DESCRIPTION
Remarks The example given on this page is a typical version. The type names are in general expected to be present, although exceptions (if any) may be described in In most cases the fundamental type which implements each typedef is implementation dependent as long as source code which uses those typedefs need not be changed. In some cases the typedef is actually a shorthand for a commonly used type, and will not vary. The data types defined in the include file are used in HP-UX system code; some data of these types are accessible to user code: typedef struct { int r[1]; } *physadr; typedef char *caddr_t; typedef unsigned int uint; typedef unsigned short ushort; typedef unsigned long ino_t; typedef short cnt_t; typedef long time_t; typedef long dev_t; typedef long off_t; typedef long paddr_t; typedef long key_t; typedef int32_t pid_t; typedef long uid_t; typedef long gid_t; typedef long blkcnt_t; Note that the defined names above are standardized, but the actual type to which they are defined may vary between HP-UX implementations. The meanings of the types are: physadr used as a pointer to memory; the pointer is aligned to follow hardware-dependent instruction addressing conventions. caddr_t used as an untyped pointer or a pointer to untyped memory. uint shorthand for unsigned integer. ushort shorthand for unsigned short. ino_t used to specify I-numbers. All native file systems (including HFS and VxFS 3.5) through HP-UX 11i, use values that will fit within 32-bits. Some remote NFS servers may use larger values, which will be truncated without error for 32-bit applications and may not result in unique values. cnt_t used in some implementations to hold reference counts for some kernel data structures. time_t time encoded in seconds since 00:00:00 GMT, January 1, 1970. dev_t specifies kind and unit number of a device, encoded in two parts known as major and minor. off_t offset measured in bytes from the beginning of a file. If a 32-bit application is compiled with or off_t will become an int64_t. paddr_t used as an integer type which is properly sized to hold a pointer. key_t the type of a key used to obtain a message queue, semaphore, or shared memory identifier, see stdipc(3C). pid_t used to specify process and process group identifiers. uid_t used to specify user identifiers. gid_t user to specify group identifiers. blkcnt_t disk quota or transfer size measured in blocks. If a 32-bit application is compiled with or blkcnt_t will become an int64_t. STANDARDS CONFORMANCE
types(5)
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy