---------- Post updated at 06:56 AM ---------- Previous update was at 06:20 AM ----------
Hi,
It looks that itoa is not supported by my compiler.
I tried with casting. However, I am getting an error:
Code:
error: invalid conversion from ‘char’ to ‘const char*’
error: initializing argument 1 of ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&)
[with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’
Code:
int ToLower(string my_input)
{
int string_length = my_input.length();
for (int i=0; i<string_length; i++) {
// here trying to convert from int to string
my_input = (string) my_input[i];
my_input[i]=tolower(my_input[i]);
}
return 0;
}
Thanks.
---------- Post updated at 07:04 AM ---------- Previous update was at 06:56 AM ----------
Ok, I found, my mistake. I am converting NOT from string but from char to *char... so my_input[i] is a char.
working on that...
---------- Post updated at 07:28 AM ---------- Previous update was at 07:04 AM ----------
Hi,
I googled it.
This should work but I am not sure in 100%.
The problem is that the server I am using has crashed)
I would be grateful for your opinion.
Code:
int ToLower(string my_input)
{
int string_length = my_input.length();
for (int i=0; i<string_length; i++) {
// here trying to convert from int to string
typedef char charType;
charType MyChar = my_input[i];
my_input[i]=tolower(my_input[i]);
}
return 0;
}
---------- Post updated at 07:39 AM ---------- Previous update was at 07:28 AM ----------
I am sorry.
My post was to chaotic.
Greetings for all.
Last edited by Scott; 12-07-2010 at 08:34 AM..
Reason: Code tags
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)
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)
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)
Hi,
from the manual
listen(2): listen for connections on socket - Linux man page
It has a parameter called backlog and it limits the maximum length of queue of pending list.
If I set backlog to 128, is it means no more than 128 packets can be handled by server?
If I have three... (3 Replies)
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)
My question is simple: When should I use a long, int, char, unsigned/signed variables??
When I declare a variable "unsigned;" what did I do it???
Why would I delcare an integer "long" or "short" ( unsigned or signed)??
Any examples of when things like "unsigned", "long", "short" etc...... (6 Replies)
As this function returns the address of the string corressponding to the errno value provided to it. Can someone please let me know where, in the memory, it could be (on freeBSD).
The MAN page tells under the BUG section that "For unknown error numbers, the strerror() function will return its... (5 Replies)
Dear all,
I am using C and ROOT for programming. And I need to incorporate following in my code.
char *fps=NULL;
int dec=0,sign=0;
float mean = h1->GetMean(1); //0.001298
fps= fcvt(mean,6 , &dec, &sign);
I need to provide this mean as const char to some other function to get... (8 Replies)
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)
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
LEARN ABOUT DEBIAN
std::ostream_iterator
std::ostream_iterator< _Tp, _CharT, _Traits >(3cxx) std::ostream_iterator< _Tp, _CharT, _Traits >(3cxx)
NAME
std::ostream_iterator< _Tp, _CharT, _Traits > -
SYNOPSIS
Inherits std::iterator< output_iterator_tag, void, void, void, void >.
Public Types
typedef void difference_type
typedef output_iterator_tag iterator_category
typedef void pointer
typedef void reference
typedef void value_type
typedef _CharT char_type
typedef _Traits traits_type
typedef basic_ostream< _CharT,
_Traits > ostream_type"
Public Member Functions
ostream_iterator (ostream_type &__s)
ostream_iterator (ostream_type &__s, const _CharT *__c)
ostream_iterator (const ostream_iterator &__obj)
ostream_iterator & operator* ()
ostream_iterator & operator++ ()
ostream_iterator & operator++ (int)
ostream_iterator & operator= (const _Tp &__value)
Detailed Description
template<typename _Tp, typename _CharT = char, typename _Traits = char_traits<_CharT>>class std::ostream_iterator< _Tp, _CharT, _Traits >
Provides output iterator semantics for streams.
This class provides an iterator to write to an ostream. The type Tp is the only type written by this iterator and there must be an
operator<<(Tp) defined.
Parameters:
Tp The type to write to the ostream.
CharT The ostream char_type.
Traits The ostream char_traits.
Definition at line 154 of file stream_iterator.h.
Member Typedef Documentation
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> typedef _CharT std::ostream_iterator< _Tp, _CharT,
_Traits >::char_type
Public typedef.
Definition at line 160 of file stream_iterator.h.
typedef void std::iterator< output_iterator_tag , void , void , void , void >::difference_type [inherited]
Distance between iterators is represented as this type.
Definition at line 126 of file stl_iterator_base_types.h.
typedef output_iterator_tag std::iterator< output_iterator_tag , void , void , void , void >::iterator_category [inherited]
One of the tag types.
Definition at line 122 of file stl_iterator_base_types.h.
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> typedef basic_ostream<_CharT, _Traits>
std::ostream_iterator< _Tp, _CharT, _Traits >::ostream_type
Public typedef.
Definition at line 162 of file stream_iterator.h.
typedef void std::iterator< output_iterator_tag , void , void , void , void >::pointer [inherited]
This type represents a pointer-to-value_type.
Definition at line 128 of file stl_iterator_base_types.h.
typedef void std::iterator< output_iterator_tag , void , void , void , void >::reference [inherited]
This type represents a reference-to-value_type.
Definition at line 130 of file stl_iterator_base_types.h.
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> typedef _Traits std::ostream_iterator< _Tp, _CharT,
_Traits >::traits_type
Public typedef.
Definition at line 161 of file stream_iterator.h.
typedef void std::iterator< output_iterator_tag , void , void , void , void >::value_type [inherited]
The type 'pointed to' by the iterator.
Definition at line 124 of file stl_iterator_base_types.h.
Constructor & Destructor Documentation
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> std::ostream_iterator< _Tp, _CharT, _Traits
>::ostream_iterator (ostream_type &__s) [inline]
Construct from an ostream.
Definition at line 171 of file stream_iterator.h.
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> std::ostream_iterator< _Tp, _CharT, _Traits
>::ostream_iterator (ostream_type &__s, const _CharT *__c) [inline]
Construct from an ostream.
The delimiter string c is written to the stream after every Tp written to the stream. The delimiter is not copied, and thus must not be
destroyed while this iterator is in use.
Parameters:
s Underlying ostream to write to.
c CharT delimiter string to insert.
Definition at line 183 of file stream_iterator.h.
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> std::ostream_iterator< _Tp, _CharT, _Traits
>::ostream_iterator (const ostream_iterator< _Tp, _CharT, _Traits > &__obj) [inline]
Copy constructor.
Definition at line 187 of file stream_iterator.h.
Member Function Documentation
template<typename _Tp , typename _CharT = char, typename _Traits = char_traits<_CharT>> ostream_iterator& std::ostream_iterator< _Tp, _CharT,
_Traits >::operator= (const _Tp &__value) [inline]
Writes value to underlying ostream using operator<<. If constructed with delimiter string, writes delimiter to ostream.
Definition at line 193 of file stream_iterator.h.
Author
Generated automatically by Doxygen for libstdc++ from the source code.
libstdc++ Tue Nov 27 2012 std::ostream_iterator< _Tp, _CharT, _Traits >(3cxx)