Sponsored Content
Top Forums Programming 'strlen' of a constant string Post 302224560 by cleopard on Wednesday 13th of August 2008 12:06:25 PM
Old 08-13-2008
Taking the 'const' off gave the same results.
 

7 More Discussions You Might Find Interesting

1. Programming

Problems with Strlen

hello, i have a problem with strlen. I have written this: for(y=13,z=0; cInBuf!=' ';y++) { cBuf=cInBuf; z++; } len = strlen(cBuf); out=len/2; fprintf(outfile,"F%i",out); If strlen is e.g. 22, it write F22. I want to write F2F2. How can i do this?... (5 Replies)
Discussion started by: ACeD
5 Replies

2. Shell Programming and Scripting

choose random text between constant string.. using awk?

Hallo I have maybe a little bit advanced request.... I need to choose one random part betwen %.... so i have this.. % text1 text1 text1 text1 text1 text1 text1 text1 text1 % text2 text2 text2 text2 text2 % text3 text3 text3 tetx3 % this choose text between % awk ' /%/... (8 Replies)
Discussion started by: sandwich
8 Replies

3. Programming

strlen for UTF-8

My OS (Debian) and gcc use the UTF-8 locale. This code says that the char size is 1 byte but the size of 'a' is really 4 bytes. int main(void) { setlocale(LC_ALL, "en_US.UTF-8"); printf("Char size: %i\nSize of char 'a': %i\nSize of Euro sign '€': %i\nLength of Euro sign: %i\n",... (8 Replies)
Discussion started by: cyler
8 Replies

4. Shell Programming and Scripting

Trouble appending string constant to variable

Hi. I define my variables as: month=jul DD=17 YEAR=2012 transmission_file_name_only=test_$month$DD$YEAR_partial.dat However when I run my script the variable 'transmission_file_name_only' resolves to: File "/downloads/test_jul17.dat" not found. How can I append this '_partial'... (3 Replies)
Discussion started by: buechler66
3 Replies

5. Shell Programming and Scripting

How to solve awk: line 1: runaway string constant error?

Hi All ! I am just trying to print bash variable in awk statement as string here is my script n=1 for file in `ls *.tk |sort -t"-" -k2n,2`; do ak=`(awk 'FNR=='$n'{print $0}' res.dat)` awk '{print "'$ak'",$0}' OFS="\t" $file n=$((n+1)) unset ak doneI am getting following error awk:... (7 Replies)
Discussion started by: Akshay Hegde
7 Replies

6. Programming

String Constant C

I wonder string constant exists permanently or temporary. For example, printf("hello, world"); the function printf access to it is through a pointer. Does it mean storage is allocated for the string constant to exist permanently in memory? :confused: (4 Replies)
Discussion started by: kris26
4 Replies

7. Programming

Segment fault related to strlen.S

Hello, This function was copied into my code, which was compiled without error/warning, but when executed there is always Segmentation fault at the end after the output (which seems correct!): void get_hashes(unsigned int hash, unsigned char *in) { unsigned char *str = in; int pos =... (7 Replies)
Discussion started by: yifangt
7 Replies
Connecting to BrlAPI(3) 					      BrlAPI						   Connecting to BrlAPI(3)

NAME
Connecting to BrlAPI - Data Structures struct brlapi_connectionSettings_t Settings structure for BrlAPI connection. Macros #define BRLAPI_SOCKETPORTNUM 4101 #define BRLAPI_SOCKETPORT '4101' #define BRLAPI_SOCKETPATH '/var/lib/BrlAPI' #define BRLAPI_ETCDIR '/etc' #define BRLAPI_AUTHKEYFILE 'brlapi.key' #define BRLAPI_DEFAUTH BRLAPI_ETCDIR '/' BRLAPI_AUTHKEYFILE #define BRLAPI_SETTINGS_INITIALIZER { NULL, NULL } Typedefs typedef int brlapi_fileDescriptor Functions brlapi_fileDescriptor BRLAPI_STDCALL brlapi_openConnection (const brlapi_connectionSettings_t *desiredSettings, brlapi_connectionSettings_t *actualSettings)" brlapi_fileDescriptor BRLAPI_STDCALL brlapi__openConnection (brlapi_handle_t *handle, const brlapi_connectionSettings_t *desiredSettings, brlapi_connectionSettings_t *actualSettings)" void BRLAPI_STDCALL brlapi_closeConnection (void) void BRLAPI_STDCALL brlapi__closeConnection (brlapi_handle_t *handle) Detailed Description Before calling any other function of the library, calling brlapi_openConnection() is needed to establish a connection to BrlAPI 's server. When the connection is not needed any more, brlapi_closeConnection() must be called to close the connection. Macro Definition Documentation #define BRLAPI_AUTHKEYFILE 'brlapi.key' Default name of the file containing BrlAPI 's authorization key This name is relative to BRLAPI_ETCDIR #define BRLAPI_DEFAUTH BRLAPI_ETCDIR '/' BRLAPI_AUTHKEYFILE Default authorization setting #define BRLAPI_ETCDIR '/etc' brltty 's settings directory This is where authorization key and driver-dependent key names are found for instance. #define BRLAPI_SETTINGS_INITIALIZER { NULL, NULL } Allows to initialize a structure of type brlapi_connectionSettings_t * with default values. #define BRLAPI_SOCKETPATH '/var/lib/BrlAPI' Default unix path on which connections to BrlAPI can be established #define BRLAPI_SOCKETPORT '4101' #define BRLAPI_SOCKETPORTNUM 4101 Default port number on which connections to BrlAPI can be established Typedef Documentation typedef int brlapi_fileDescriptor Function Documentation void BRLAPI_STDCALL brlapi__closeConnection (brlapi_handle_t *handle) brlapi_fileDescriptor BRLAPI_STDCALL brlapi__openConnection (brlapi_handle_t *handle, const brlapi_connectionSettings_t *desiredSettings, brlapi_connectionSettings_t *actualSettings) void BRLAPI_STDCALL brlapi_closeConnection (void) Cleanly close the socket This function locks until a closing acknowledgement is received from the server. The socket is then freed, so the file descriptor brlapi_openConnection() gave has no meaning any more brlapi_fileDescriptor BRLAPI_STDCALL brlapi_openConnection (const brlapi_connectionSettings_t *desiredSettings, brlapi_connectionSettings_t *actualSettings) Open a socket and connect it to BrlAPI 's server This function first loads an authorization key as specified in settings. It then creates a TCP socket and connects it to the specified machine, on the specified port. It writes the authorization key on the socket and waits for acknowledgement. Returns: the file descriptor, or -1 on error Note: The file descriptor is returned in case the client wants to communicate with the server without using libbrlapi functions. If it uses them however, it won't have to pass the file descriptor later, since the library keeps a copy of it. But that also means that brlapi_openConnection() may be called several times, but libbrlapi functions will always work with the last call's descriptor Example: if (brlapi_openConnection(&settings,&settings)<0) { fprintf(stderr,'couldn't connect to BrlAPI at %s: %s0, settings.host, brlapi_strerror(&brlapi_error)); exit(1); } Errors: BrlAPI might not be on this TCP port, the host name might not be resolvable, the authorization may fail,... Parameters: desiredSettings this gives the desired connection parameters, as described in brlapi_connectionSettings_t. If NULL, defaults values are used, so that it is generally a good idea to give NULL as default, and only fill a brlapi_connectionSettings_t structure when the user gave parameters to the program for instance; actualSettings if not NULL, parameters which were actually used are stored here, if the application ever needs them. See Also: brlapi_connectionSettings_t brlapi_writePacket() brlapi_readPacketHeader() brlapi_readPacketContent() brlapi_readPacket() Author Generated automatically by Doxygen for BrlAPI from the source code. Version 1.0 Fri Jun 7 2013 Connecting to BrlAPI(3)
All times are GMT -4. The time now is 03:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy