473,507 Members | 8,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing pointer to pointer to a string

drhowarddrfine
7,435 Recognized Expert Expert
I'm not 100% sure if what I'm writing is the problem or if the problem is elsewhere. I am given this '**string;' which, of course points to a string. I need to print this string. I'm simply doing printf("%s",string) and every combination with '*' thereof but not getting the expected string to print (either garbage or a fault). What am I forgetting?
Oct 20 '07 #1
4 2350
drhowarddrfine
7,435 Recognized Expert Expert
Hmm. Might be something else is the problem. I looked at the assembly language and what I originally tried seems to be working:
printf("%s",**string);

The function that is giving me **string is declared as
'char** getstring(void);'
and I am doing this:
Expand|Select|Wrap|Line Numbers
  1. char** string;
  2. char** getstring(void);
  3.  
  4. string=getstring();
  5. printf("%s",**string);
  6.  
Oct 20 '07 #2
drhowarddrfine
7,435 Recognized Expert Expert
Nope. So I'm back to my original question. Am I forgetting something?
Oct 20 '07 #3
oler1s
671 Recognized Expert Contributor
I am given this '**string;' which, of course points to a string
Nope. A char* might point to a C string. char * array like char *string[] could also be expressed as char**. You have an array of strings on hand. Might want to take a closer look at the code that is involved.
Oct 20 '07 #4
drhowarddrfine
7,435 Recognized Expert Expert
Can we all say "Arrrrghhh!"

In my print routine, I wasn't checking for when there was no string. The way it would fail made me think it was problems with my pointer scheme.
Oct 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4833
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
14
7781
by: Steven T. Hatton | last post by:
I'm trying to write a program like hexel. I guess I could fish out the source for hexel and look at that, but for now I'm trying to figure out how I can do with with std::stringstream and...
42
5856
by: junky_fellow | last post by:
Consider an implementation that doesn't use all bits 0 to represent a NULL pointer. Let the NULL pointer is represented by 0x12345678. On such an implementation, if the value of NULL pointer is...
5
10072
by: Patrick De Ridder | last post by:
How can I turn what I want to print 90 degrees using the logic below? Please tell me the code with which to make the modification. Many thanks, Patrick. using System.ComponentModel; using...
4
3140
by: Rob T | last post by:
I have a small VB program that has a printing module...very simple....and works great. However, If I try to print to a generic printer, I get the following error: "The data area passed to a...
5
12805
by: Tom | last post by:
I am converting an old application that was printing directly to a specialized printer device (i.e. a special label printer). It was doing this by opening a file with the file path of 'LPT1:' and...
1
5682
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
3
3680
by: John Peterson | last post by:
Hello all! I'm at my wits end trying to search for what I assumed to be a relatively straightforward task. I have a Web application written in C#, and I have a button on the form that I want to...
9
2997
by: junky_fellow | last post by:
Hi, To print the pointer using printf(), we convert it to (void *) . printf("%p",(void *)ptr); My question is how printf() determine which type of pointer is passed to it and prints its value...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7481
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.