Sponsored Content
Top Forums Programming Double to const char conversion Post 302771981 by DGPickett on Friday 22nd of February 2013 10:32:23 AM
Old 02-22-2013
PS: Back burner of brain bubble: FILE* also needs to have an EOF/error save variables for feof() and ferror(), but might rely on real EOF and errno. Let's look! I **never** looked before, I just inferred (so much cheaper!) HP-UX 11.00 stdio.h, excuse my line numbers:
Code:
63    _NAMESPACE_STD_START
64       typedef struct {
65        int         __cnt;
66        unsigned char    *__ptr;
67        unsigned char    *__base;
68        unsigned short     __flag;
69        unsigned char      __fileL;        /* low byte of file desc */
70        unsigned char      __fileH;        /* high byte of file desc */
71       } FILE;
72    _NAMESPACE_STD_END

It is very important that programmers realize all the FILE* stuff is inside the process, and it does all its work with the embedded fd. I was considering writing a new super_FILE* that, when you might block on FILE* I/O, services all FILE*, emptying write buffers and filling read buffers, maybe even with its own threads to take the system call hits.

Last edited by DGPickett; 02-22-2013 at 11:40 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

char to int64 conversion

Hi, I'm converting a C program that I made using the Visual Studio. I now use GCC (over Linux) and can't find some equivalences. I changed my __int64 definitions to unsigned long long, but can't find an equivalent to the microsoft i64toa() function, which let you convert a char* to a 64 bit... (1 Reply)
Discussion started by: Raspoutine
1 Replies

2. Programming

diff b/w char const in C/C++

hi, what is the difference b/w char in C and C++.and give me the examples. Thanks... sarwan (3 Replies)
Discussion started by: sarwan
3 Replies

3. UNIX for Dummies Questions & Answers

int open(const char *pathname, int flags, mode_t mode) doubt...

hello everybody! I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fileDescriptor; fileDescriptor =... (2 Replies)
Discussion started by: csnmgeek
2 Replies

4. UNIX for Dummies Questions & Answers

ANSI C, char to hex conversion

Hi, I have a char buf,ch; and the buf is filled with the result from MySQL server which I get like this numbytes = recv(sock, buf, 1024, 0));I have the followingcode to display the results printf("received %ld bytes:\n",numbytes); for(c=0;c<numbytes;c++){ ch = (char)buf; ... (2 Replies)
Discussion started by: alikims
2 Replies

5. Programming

concat const char * with char *

hello everybody! i have aproblem! i dont know how to concatenate const char* with char const char *buffer; char *b; sprintf(b,"result.txt"); strcat(buffer,b); thanx in advance (4 Replies)
Discussion started by: nicos
4 Replies

6. Programming

conversion to 'char' from 'int' warning

Hi, I wrote a simple code in C++ converting from UpperToLower case characters. However, my compiler gives me a warning: "warning: conversion to 'char' from 'int' may alter its value". Any tips? I would like to stress, I don't want to load my string into char array. int ToLower(string... (4 Replies)
Discussion started by: kajolo
4 Replies

7. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

8. Programming

Using const char*

I am writing some code in C++ to print a message using fprintf Here is an example void pr_desc( FILE* stream, int shift, const char* desc) { const char* format="%*s\e; fprintf(stream,format,shift,"",desc); } I call it using const char* desc; ... (4 Replies)
Discussion started by: kristinu
4 Replies

9. Programming

Invalid conversion from char* to char

Pointers are seeming to get the best of me and I get that error in my program. Here is the code #include <stdio.h> #include <stdlib.h> #include <string.h> #define REPORTHEADING1 " Employee Pay Hours Gross Tax Net\n" #define REPORTHEADING2 " Name ... (1 Reply)
Discussion started by: Plum
1 Replies

10. Programming

Bool vs char * conversion

I have a problem at make step to install a downloaded package consisted of different programs. In file included from kcdbext.cc:16:0: kcdbext.h: In member function �char* kyotocabinet::IndexDB::get(const char*, size_t, size_t*)’: kcdbext.h:1281:14: error: cannot convert �bool’ to... (3 Replies)
Discussion started by: yifangt
3 Replies
ferror(3C)						   Standard C Library Functions 						ferror(3C)

NAME
ferror, feof, clearerr, fileno - stream status inquiries SYNOPSIS
#include <stdio.h> int ferror(FILE *stream); int feof(FILE *stream); void clearerr(FILE *stream); int fileno(FILE *stream); DESCRIPTION
The ferror() function returns a non-zero value when an error has previously occurred reading from or writing to the named stream (see Intro(3)). It returns 0 otherwise. The feof() function returns a non-zero value when EOF has previously been detected reading the named input stream. It returns 0 otherwise. The clearerr() function resets the error indicator and EOF indicator to 0 on the named stream. The fileno() function returns the integer file descriptor associated with the named stream; see open(2). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
open(2), Intro(3), fopen(3C), stdio(3C), attributes(5), standards(5) SunOS 5.11 17 Feb 2005 ferror(3C)
All times are GMT -4. The time now is 12:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy