Sponsored Content
Full Discussion: String Constant C
Top Forums Programming String Constant C Post 302843852 by kris26 on Thursday 15th of August 2013 10:43:32 AM
Old 08-15-2013
For example,
Code:
int *pointer = "Hello, World";

Is the string constant available until the pointer variable as an automatic variable is discarded?
 

7 More Discussions You Might Find Interesting

1. Programming

'strlen' of a constant string

In a declaration, I have: const char comment_begin = "<!--"; const char comment_end = "-->"; const int comment_begin_len = strlen(comment_begin); const int comment_end_len = strlen(comment_end); When I compile, I get the warnings: emhttpc.c:64: warning: initializer element is not... (10 Replies)
Discussion started by: cleopard
10 Replies

2. Shell Programming and Scripting

Constant mirroring

I'm not sure how to best explain what I'd like to do, so let me give an example. I used to work in a department that deals with internet security. This department had an "internal" website (only people in the building can get on it) and an "external" website (anyone in the world can get on it --... (1 Reply)
Discussion started by: sstevens
1 Replies

3. 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

4. Solaris

Constant disturbing messages????

Hi friends, I am new to Solaris, I have just managed to install Solaris 10 under VirtualBox. As I use the system, I constantly get some very disturbing error messages on my screen, I hope you will help me remove them. Messages are # syslogd: line 24: WARNING: loghost could not be resolved ... (6 Replies)
Discussion started by: gabam
6 Replies

5. 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

6. 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

7. Debian

LM 17.3 xfce constant lagging

I'm using LM 17.3x LIVE. Have constant and sometimes, severe lagging issues. Problems started when I "upgraded" to 18.3x. I tried 5 other distros all with the same issues. Went back to 17.3 and , alas, the problem followed. Found this: sudo gedit /etc/sysctl. conf vm. swappiness = 15, but all it... (4 Replies)
Discussion started by: 69Rixter
4 Replies
MYSQLI_SELECT_DB(3)							 1						       MYSQLI_SELECT_DB(3)

mysqli::select_db - Selects the default database for database queries

       Object oriented style

SYNOPSIS
bool mysqli::select_db (string $dbname) DESCRIPTION
Procedural style bool mysqli_select_db (mysqli $link, string $dbname) Selects the default database to be used when performing queries against the database connection. Note This function should only be used to change the default database for the connection. You can select the default database with 4th parameter in mysqli_connect(3). PARAMETERS
o $ link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3) o $dbname - The database name. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 mysqli::select_db example Object oriented style <?php $mysqli = new mysqli("localhost", "my_user", "my_password", "test"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } /* return name of current default database */ if ($result = $mysqli->query("SELECT DATABASE()")) { $row = $result->fetch_row(); printf("Default database is %s. ", $row[0]); $result->close(); } /* change db to world db */ $mysqli->select_db("world"); /* return name of current default database */ if ($result = $mysqli->query("SELECT DATABASE()")) { $row = $result->fetch_row(); printf("Default database is %s. ", $row[0]); $result->close(); } $mysqli->close(); ?> Procedural style <?php $link = mysqli_connect("localhost", "my_user", "my_password", "test"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s ", mysqli_connect_error()); exit(); } /* return name of current default database */ if ($result = mysqli_query($link, "SELECT DATABASE()")) { $row = mysqli_fetch_row($result); printf("Default database is %s. ", $row[0]); mysqli_free_result($result); } /* change db to world db */ mysqli_select_db($link, "world"); /* return name of current default database */ if ($result = mysqli_query($link, "SELECT DATABASE()")) { $row = mysqli_fetch_row($result); printf("Default database is %s. ", $row[0]); mysqli_free_result($result); } mysqli_close($link); ?> The above examples will output: Default database is test. Default database is world. SEE ALSO
mysqli_connect(3), mysqli_real_connect(3). PHP Documentation Group MYSQLI_SELECT_DB(3)
All times are GMT -4. The time now is 09:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy