Programming :: Make A Template Char Or Wchar_t Default Function Argument?

Oct 30, 2009

I have a template similar to the following.


template <charT>
virtual void do_get_date(charT* = "str")
{ ... }

As you can see we have a problem. If we use a wchar_t instead the string wont be formatted right we need to prefix L in front. If we use char16_t we need to prefix a u in front. Is there a was to make the generic without resorting the the std::string class?

View 2 Replies


Programming :: Convert Const Wchar_t* To Const Char* To Use In Fprintf()?

Jan 17, 2011

I�m developing c++ application which is run on linux. I have a const wchar_t* which is returned from a method. I have a FILE * _pFile which is open for read/write.I need to write that const wchar_t* to that file. I used fprintf() to write other data types. Can I used fprintf method to do that also? If so how can I covert const wchar_t* to const char*

View 1 Replies View Related

Programming :: Passing The Char * Vector Argument?

Jun 19, 2010

I am trying to simulate a shell. So what I do is checking of having the parameters from standard input, suc as "/bin/ls -l /home/france/Documents", and then passing them to function execute, which at some point calls execvp(argv[0],argv)The problem is that I don't succeed in using these arguments, while if I call execvp(paramList[0],paramList) it works!!!! Where paramList is exactly what I would put on standard input, but defined statically.




View 2 Replies View Related

Programming :: C Function Not Returning An Integer After Comparing It To A Char?

Jan 23, 2010

I've got a strange bug that I cannot figure out how to solve. Here is the function.

int getnexttab(char input[], int index, int length)


View 14 Replies View Related

Programming :: Pass A Char* Array As A Function Paramter In C++?

Jan 27, 2011

I have the following char* array

char* chrarray[] = {"Hello","LinuxQuestions"};
and I need to pass it into a function, how should I define my function in the header file?


View 3 Replies View Related

Programming :: Bash Array Add Function Example Using Indirect Array Reference As Function Argument?

Jun 20, 2010

I looked on the net for such function or example and didin't find anything, thus after having made one i guess it would be legitimate to drop it to see what others thinks of it.

local arrayname=$1


View 10 Replies View Related

Programming :: C++ Program Calling A Fortran Subroutine With A Function In The Argument?

Mar 9, 2011

I have a new problem; i want to call a subroutine's fortran which have a function in the argument and the compilation ran properly, but when i execute the program this shows me an "Segmentation fault". This is my c++ program:

Code: //Main.cpp
#include <stdio.h>
#include <iostream>


View 2 Replies View Related

Software :: Hash Map Compilation Error - Template Argument Invalid

Feb 10, 2011

I am compiling the code has hash_map getting following error

typedef std::hash_map<uint32_t, CTM_ContextData> contexts_map_t;
Compilation Error:
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:77: error: ISO C++ forbids declaration of 'hash_map' with no type
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:77: error: typedef name may not be a nested-name-specifier
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:77: error: expected ';' before '<' token
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:78: error: 'contexts_map_t' was not declared in this scope
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:78: error: template argument 1 is invalid
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:78: error: template argument 2 is invalid
/vobs/ims_hss1/ctm/inc/CTM_DidMemContextManager.h:85: error: 'contexts_map_t' does not name a type

View 2 Replies View Related

Programming :: Fixing C++ Invalid Conversion From Const Char* To Char?

Mar 4, 2010

m getting the following error when trying to compile:Quote:

$ make
g++ -march=athlon64 -O2 -pipe -fomit-frame-pointer -msse3 -c -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"undelete"' -DHAVE_SVDRP -I../../../include undelete.c


View 14 Replies View Related

Programming :: Point A Char Pointer To A Part Of Another Char Array?

Nov 4, 2010

Programming in C.I have two char arrays.char buf1[1024];char buf2[1024];Aren't buf1 and buf2 also pointers?I read in 1024 bytes into buf1 which contain about 300 bytes of characters with newlines. The data is basically a few English sentences. I'm trying to scan buf1 for newlines and then stop at the 1st newline and copy the rest of the data from that 1st newline into buf2.So I run a for loop to look for that new line.

for(i=0; i<1024;i++) {
if((strcmp(&buf1[i], "


View 8 Replies View Related

Programming :: C++ Invalid Conversion From Const Char* To Char*

Jul 9, 2010

I am having trouble with the following exception class.


/**Standard Exception


Line 43 points at the snprintf() command.I think the error has to do with the function being virtual and the const after the function definition, however although I have been looking really hard I have not being able to find the reason nor the solution to the problem.

One workaround that I know is moving the block of source withing the virtual function, in the constructor, however having read around (boost library exceptions tutorials) it specifically said that formating of errors messages should not take place withing the construction of objects because we are risking throwing an exceptions and messing up the flow order.

View 11 Replies View Related

Programming :: Char Variable Is Behaving As Unsigned Char?

Feb 14, 2011

i define variable of type char (range -128 to 127). when i tried to print the value after assigning a -ve value to it it displaying a +ve value of that -ve value(256+value).

View 3 Replies View Related

Programming :: SH: Remove Last Char If It Is An Empty Char In A String

Jul 5, 2011

With this I may remove the last emtpy char which is not visible, coming from net, windows, ...

echo "$mystringwindowsorotherwithemptylastchar" |sed s/.$//

However if there are not then it makes a problem and delete effectively an existing char.

echo "klklj" |sed s/.$//

Anyone would have a solution for SH?

View 2 Replies View Related

Programming :: Convert A Char * To Unsigned Char?

Mar 4, 2010

is it possible to convert a variable from char * to unsigned char ?

View 5 Replies View Related

Programming :: How To Make Pinging Function More Efficient

Mar 13, 2010

I am starting a project of my own (and learning C++ at the same time. I got my program to successfully scan a custom netmask, but it is REALLY slow. I want my program to do something similar to nmap -sP How to speed it up? Such as pinging more than one IP at a time...

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <sstream>

using namespace std;
int ip42;
string ip1, ip2, ip3, ip4, ipaddr;
int main() {

cout << endl << "Enter part 1: ";
cin >> ip1;
cout << endl << "Enter part 2: ";
cin >> ip2;
cout << endl << "Enter part 3: ";
cin >> ip3;
cout << endl << "Enter part 4: ";
cin >> ip4;
while(ip42 < 255){
ipaddr = string("ping -c 1 ").append(ip1);
ipaddr = string(ipaddr).append(ip2);
ipaddr = string(ipaddr).append(ip3);
ipaddr = string(ipaddr).append(ip4);
ip42 = atoi(ip4.c_str());
ip42 += 1;
stringstream output;
output << ip42;
output >> ip4; } }

View 2 Replies View Related

General :: Determine The Value Of The 'irq' Argument Before Calling Function?

Oct 27, 2010

I read somewhere that you should not be reading config space to determine the irq value to pass as the first argument to request_irq(). What is the proper way to determine the value of the 'irq' argument before calling this function? Hope this is the correct forum. I don't see one for drivers.

View 1 Replies View Related

Fedora :: Set The Default Text (as Template) Whenever Open It?

Feb 8, 2011

in MS word, we can set The default text(as template) whenever we open it. so we can avoid the repetitive typing.

is it possible in vim editor?

i need to type,




whenever i write the new script.. i am repeating the above format.. is there any possiblity to set vim editor to display the above text as default?

View 5 Replies View Related

Programming :: Programing - Reading File Line By Line Then Char By Char In Each Line

May 29, 2010

I've never programed shell scripting.

Code goes like so:

I simply want to read a file "data.txt" line by line Then char by char and add them into a result var. The file is supossed to always contain numeric values

View 8 Replies View Related

Ubuntu :: Change The Default Template Used By Gnumeric At Startup?

Aug 18, 2010

Can I change the default template used by gnumeric at startup? How?

View 1 Replies View Related

Ubuntu :: Customize Mdadm Default Email Template?

Oct 12, 2010

Ubuntu Server 10.04 (Lucid Lynx)

I'm looking for ways to customize the default mdadm email template. I don't like the wording of the template, and i'd like to gear it towards my implementation.

1) can i customize the default template?

a) if so, how?

b) if not, how can I create a new template and use that?

View 1 Replies View Related

General :: Make A Template For Thunderbird?

Dec 28, 2010

I want to make a template for Thunderbird. I want the image to be on top and I will put fonts under it. My attempts at inserting an image have resulted in one very large image taking up the entire page.

View 2 Replies View Related

Ubuntu Security :: ClamAV - Clamscan With Libclamav Error (opcode And Bytecode) Failed To Run: Invalid Argument Passed To Function

Jul 23, 2011

after upgrading ClamAV to version 0.97.1 and run the command Code: clamscan -r -i / --exclude-dir=^/sys --exclude-dir=^/dev --exclude-dir=^/proc | mail -s "clamav scan report XYSERVER" the following errors appeared:


View 3 Replies View Related

Programming :: How Can A Friend Function Access A Public Function From A Base Class

Nov 16, 2010

#include <iostream>
using namespace std;


View 1 Replies View Related

Programming :: Passing Data From Interrupt Handler Function To Tasklet Function?

May 18, 2010

I am doing some Linux kernel programming for my research project. I need to record the timestamp (by using cpuid and rdtsc) when an interrupt handler (top half) is first invoked. Due to the time critical nature of the problem itself, I have to do the timestamping inside the interrupt handler itself (the first operation when the handler is called). However, I understand that tasks that are not so time critical should be deferred to a tasklet function (bottom half) for processing because other interrupts are disabled in a (top-half) interrupt handler. I am currently out of idea on how I can pass the timestamp information that I have obtained in the interrupt handler to the corresponding tasklet function.

View 2 Replies View Related

Programming :: C++ Template Specialization?

Feb 6, 2011

I am having trouble understanding some concepts regarding C++ template specialization and I was hopping you guys can help me like you did last time.I will go right into the code and let the code do the talking.File foo.hpp

// Template Class
template < typename T1, typename T2> struct foo {


View 2 Replies View Related

Software :: Using Checkinstall To Make Eboard: Deprecated Conversion From String Constant To Char*

May 16, 2011

I am trying, using checkinstall to make eboard to enable use of this program with a DGT electronic chessboard (option not available in the program included in the repositories) according to the instructions given here. After the preliminaries, namely downloading and extracting the source from: [URL]-1.1.1.tar.bz2./configure runs fine but (after su-ing to root), both make install & checkinstall fail after numerous warnings about "deprecated conversion" like:

Code: warning: deprecated conversion from string constant to 'char*' warning: deprecated conversion from string constant to 'char*' In function 'gboolean board_expose_event(GtkWidget*, GdkEventExpose*, void*)': warning: deprecated conversion from string constant to 'char*' warning: deprecated conversion from string constant to 'char*'

View 4 Replies View Related

Programming :: Template Algorithm For Std::vector And Std::string?

Sep 8, 2010

I have two functions:


void func1(std::string &s)


Is there a way to create one template function for both vector and string that would clear them?

View 4 Replies View Related

Programming :: G++ Fails On Multiple Files If There's A Template Involved

Aug 12, 2010

If I remove all the template stuff, it works.

whats going on here?

View 2 Replies View Related

Programming :: Define A Static Member In A Template Class?

Oct 6, 2009

i have trouble to define a static member in a template, and i search from google, but didn't find any similar case, my case is a little complex, i paste the code below.code in xxx.h

template <class T> class FreeListManager


View 6 Replies View Related

Programming :: Write A Stream Inserter For A Template Class?

Mar 28, 2011

I had some trouble doing this but finally figured it out. Here is a general solution:

#include <iostream>
using namespace std;


View 1 Replies View Related

Copyrights 2005-15, All rights reserved