dev-cpp-users Mailing List for Dev-C++ (Page 171)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sa...@op...> - 2004-11-06 23:13:03
|
> Obi wrote: > >> m_listenSocket = socket( AF_INET, SOCK_STREAM, 0 ); > > > This is not right. Never call socket() with an AF_ argument; it should > be PF_ (PF_INET in this case). AF_INET just "works" here by coincidence, > because most of the BSD-sockets implementations use the same value for > them. This is just as correct as using "socket(2, 1, 0);". > This is not exactly true. The BSD standard says that the AF_ value will be the same as PF_ value (this could be found on linux man pages). But you are right, the value should be PF_INET because it describes the protocol family not the address family. --- Krzysztof Kapuscik |
|
From: Rob L. <rob...@nt...> - 2004-11-06 23:10:29
|
I viewed the last previous thread about a strtoi function in whihc i = understand fully but now i would look to know how to implment a itostr function i.e = conver an integer to a string can someone please lead me in the right direction regards Rob |
|
From: Daniel K. O. <dan...@ya...> - 2004-11-06 20:11:57
|
Obi wrote: > m_listenSocket = socket( AF_INET, SOCK_STREAM, 0 ); This is not right. Never call socket() with an AF_ argument; it should be PF_ (PF_INET in this case). AF_INET just "works" here by coincidence, because most of the BSD-sockets implementations use the same value for them. This is just as correct as using "socket(2, 1, 0);". Daniel K. O. |
|
From: Haim B. <hoh...@ma...> - 2004-11-06 19:24:32
|
Hello I have installed Dev-C++ 4.9.9.0 I am using windows xp When I run a program I have wrote opens the dos window and then it closes. How can I do that it will stay open after the program ends to run. Thank you. |
|
From: Obi <ob...@ch...> - 2004-11-06 18:50:12
|
At 02:20 07/11/2004 +0900, Peter Dennis wrote:
>Hi,
>
>Can someone tell me why it is important to fill out a sockaddr structure
>to 16 bytes.
>
>Reading a book it says that the structure is as follows:
>
>struct sockaddr {
> unsigned short sa_family;
> char sa_data[14];
>}
>
>Why fill it out to 16 bytes? Is this a magic number in computers?
>
>If the address family I choose is AF_INET then how do I know that this
>takes only 2 bytes in the structure? Is there a way to calculate this?
>How do I know that I need to set sa_data to 14 and not 15?
>
>Any information regarding this would be great.
>
>Many thanks,
>Peter.
socakaddr is a generic structure for all family types used to pass addresses
to functions that don't depend on the family type.
If you use AF_INET you should use the sockaddr_in definition to manipulate
the data.
Use a reinterpret_cast<> to swap between the two defs for the
same in-memory data.
e.g.
m_listenSocket = socket( AF_INET, SOCK_STREAM, 0 );
// Bind Socket
sockaddr_in lsa;
memset( &lsa, 0, sizeof(lsa) );
lsa.sin_family = AF_INET;
lsa.sin_port = htons( LISTEN_PORT );
lsa.sin_addr.s_addr = htonl( INADDR_ANY );
SOCKET ls;
bind( ls, reinterpret_cast<sockaddr*>( &lsa ), sizeof(lsa) );
// Listen on socket
listen( ls, QSIZE );
Hope this helps,
O
|
|
From: Peter D. <don...@ne...> - 2004-11-06 17:20:24
|
Hi,
Can someone tell me why it is important to fill out a sockaddr structure
to 16 bytes.
Reading a book it says that the structure is as follows:
struct sockaddr {
unsigned short sa_family;
char sa_data[14];
}
Why fill it out to 16 bytes? Is this a magic number in computers?
If the address family I choose is AF_INET then how do I know that this
takes only 2 bytes in the structure? Is there a way to calculate this?
How do I know that I need to set sa_data to 14 and not 15?
Any information regarding this would be great.
Many thanks,
Peter.
|
|
From: Michal M. <mi...@mo...> - 2004-11-06 12:05:53
|
Justin Fan wrote: > I can't find mirrors.cfg under the install path \Dev-CPP, and I can't > find any files contains "PlaneMirrors.com" which is an existent mirror > in Dev-CPP. > Would you show me the full path? something like e.g.: c:\documents and settings\<your_user_name>\Local Settings\Application Data if you have 4.9.9.0 you can simply delete the mirrors.cfg file and the devpaks.org mirror will show -- Regards, Michal |
|
From: Justin F. <jus...@gm...> - 2004-11-06 10:19:30
|
I can't find mirrors.cfg under the install path \Dev-CPP, and I can't find any files contains "PlaneMirrors.com" which is an existent mirror in Dev-CPP. Would you show me the full path? On Sat, 06 Nov 2004 07:17:33 -0200, Daniel K. O. <dan...@ya...> wrote: > Justin Fan wrote: > > >I just read such infos that "Can I download these devpaks using > >Dev-C++ WebUpdate feature?Upgrade to latest Dev-C++ version (4.9.9.0) > >and in WebUpdate select devpaks.org as a mirror." on the devpak > >webpage. But I can't find where can I do it, I can't find somewhere to > >add mirror to list. does anyone know? > > > > > > Open the "mirrors.cfg" file and add this line: > > devpaks.org=http://devpaks.org > > > Daniel K. O. > > -- Thanks Z.J. |
|
From: Daniel K. O. <dan...@ya...> - 2004-11-06 09:19:11
|
Justin Fan wrote: >I just read such infos that "Can I download these devpaks using >Dev-C++ WebUpdate feature?Upgrade to latest Dev-C++ version (4.9.9.0) >and in WebUpdate select devpaks.org as a mirror." on the devpak >webpage. But I can't find where can I do it, I can't find somewhere to >add mirror to list. does anyone know? > > Open the "mirrors.cfg" file and add this line: devpaks.org=http://devpaks.org Daniel K. O. |
|
From: Malcolm N. <m.n...@wa...> - 2004-11-06 09:17:23
|
> Aloha from Honolulu, > I'm just beggining with a wxWidgets installation and some issues are > puzzelling me: the installation notes say to alter the WXWIN environment > variable. Can somebody tell me what that is? > The notes also say to use only forward slashes / to designate > directories and sub-directories (from my MSDOS days I still call 'em > that), I think that only applies within certain files or the WXWIN > environment variable since windows (I'm using WinXP Pro) has always used > back slashes \ in directory commands and when displaying same. Can > somebody help clear this up a bit? > Mahalo (Thank You), To cut a long story short I would suggest you download wxDevCpp http://wxdsgn.sourceforge.net/ which is a version of DevCpp with wxwidgets already included. It also has a simple form designer, and is compatible with wxWidgets 2.5.3 (it has the UpCase devPak included in the distribution. Doing this saves alot of time and headaches. Best Mal |
|
From: Roger F. <ra...@ha...> - 2004-11-06 06:35:26
|
Aloha from Honolulu, I'm just beggining with a wxWidgets installation and some issues are puzzelling me: the installation notes say to alter the WXWIN environment variable. Can somebody tell me what that is? The notes also say to use only forward slashes / to designate directories and sub-directories (from my MSDOS days I still call 'em that), I think that only applies within certain files or the WXWIN environment variable since windows (I'm using WinXP Pro) has always used back slashes \ in directory commands and when displaying same. Can somebody help clear this up a bit? Mahalo (Thank You), Roger Furer |
|
From: <tri...@ma...> - 2004-11-06 04:43:39
|
Hey Guys!
This is my frist post (wow)
I've been trying to code a service using Dev-Cpp and as any
good-boy rookie I started at the tutorials. I tried the
following Example code, and though it compiled ok, the
StartServiceCtrlDispatcher() function kept on returning
error 1066 (which is "service exited with a specific error
code"), and the ServiceMain() function never started..
Can any of you guys give me hand ?
here is the source
// Test Service
#include <windows.h>
#include <stdio.h>
#define SLEEP_TIME 5000
#define LOGFILE "c:\memstatus.txt"
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hStatus;
void ServiceMain(int argc, char** argv);
void ControlHandler(DWORD request);
int InitService();
int WriteToLog(char* str)
{
FILE* log;
log =3D fopen(LOGFILE, "a+");
if (log =3D=3D NULL)
return -1;
fprintf(log, "%s\n", str);
fclose(log);
return 0;
}
int main()
{ WriteToLog("\nApp Starting");
SERVICE_TABLE_ENTRY ServiceTable[2];
ServiceTable[0].lpServiceName =3D "MemoryStatus";
ServiceTable[0].lpServiceProc =3D
(LPSERVICE_MAIN_FUNCTION)ServiceMain;
ServiceTable[1].lpServiceName =3D NULL;
ServiceTable[1].lpServiceProc =3D NULL;
// Start the control dispatcher thread for our service
StartServiceCtrlDispatcher(ServiceTable);
WriteToLog("\nApp Ending");
}
void ServiceMain(int argc, char** argv)
{ WriteToLog("Entering ServiceMain");
int error;
ServiceStatus.dwServiceType =3D
SERVICE_WIN32_OWN_PROCESS ;
ServiceStatus.dwCurrentState =3D
SERVICE_START_PENDING;
ServiceStatus.dwControlsAccepted =3D SERVICE_ACCEPT_STOP
| SERVICE_ACCEPT_SHUTDOWN;
ServiceStatus.dwWin32ExitCode =3D 0;
ServiceStatus.dwServiceSpecificExitCode =3D 0;
ServiceStatus.dwCheckPoint =3D 0;
ServiceStatus.dwWaitHint =3D 0;
hStatus =3D RegisterServiceCtrlHandler(
"MemoryStatus",
(LPHANDLER_FUNCTION)ControlHandler);
if (hStatus =3D=3D (SERVICE_STATUS_HANDLE)0)
{
// Registering Control Handler failed
return;
}
// Initialize Service
error =3D InitService();
if (error)
{
ServiceStatus.dwCurrentState =3D
SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode =3D -1;
SetServiceStatus(hStatus, &ServiceStatus);
return;
}
// We report the running status to SCM.
ServiceStatus.dwCurrentState =3D SERVICE_RUNNING;
SetServiceStatus (hStatus, &ServiceStatus);
MEMORYSTATUS memory;
// The worker loop of a service
while (ServiceStatus.dwCurrentState =3D=3D SERVICE_RUNNING)
{
char buffer[16];
GlobalMemoryStatus(&memory);
sprintf(buffer, "%d", memory.dwAvailPhys);
int result =3D WriteToLog(buffer);
if (result)
{
ServiceStatus.dwCurrentState =3D SERVICE_STOPPED;
ServiceStatus.dwWin32ExitCode =3D -1;
SetServiceStatus(hStatus, &ServiceStatus);
return;
}
Sleep(SLEEP_TIME);
}
return;
}
// Service initialization
int InitService()
{
int result;
result =3D WriteToLog("Monitoring started.");
return(result);
}
// Control handler function
void ControlHandler(DWORD request)
{
switch(request)
{
case SERVICE_CONTROL_STOP:
WriteToLog("Monitoring stopped.");
ServiceStatus.dwWin32ExitCode =3D 0;
ServiceStatus.dwCurrentState =3D SERVICE_STOPPED;
SetServiceStatus (hStatus, &ServiceStatus);
return;
case SERVICE_CONTROL_SHUTDOWN:
WriteToLog("Monitoring stopped.");
ServiceStatus.dwWin32ExitCode =3D 0;
ServiceStatus.dwCurrentState =3D SERVICE_STOPPED;
SetServiceStatus (hStatus, &ServiceStatus);
return;
default:
break;
}
// Report current status
SetServiceStatus (hStatus, &ServiceStatus);
return;
}</br>-----------------------------</br>
<a target=3D'_blank' href=3D"http://www.mail.bg/ads/adclick.php?bannerid=3D1=
809&zoneid=3D13&source=3D&dest=3Dhttp%3A%2F%2Fwww.vega-exchanges=
.org+&ismap=3D">
<b>Work & Travel in USA - =D1=F2=F3=E4=E5=ED=F2=F1=EA=E8 =E1=F0=E8=E3=E0=E4=
=E8 =E2 =D1=C0=D9.</b></br>
=C8=F1=EA=E0=F8 =EB=E8 =E4=E0 =F1=EF=E5=F7=E5=EB=E8=F8 $$$? =CA=E0=EA=E2=EE =
=F7=E0=EA=E0=F8 =EE=F9=E5? =C7=E0=EF=E8=F8=E8 =F1=E5!</br>
=CF=EE=E4=F0=EE=E1=ED=EE=F1=F2=E8 =ED=E0 =E0=E4=F0=E5=F1: http://www.vega-ex=
changes.org </a><div id=3D"beacon_1809" style=3D"position: absolute; left: 0=
px; top: 0px; visibility: hidden;"><img src=3D'http://www.mail.bg/ads/adlog.=
php?bannerid=3D1809&clientid=3D1078&zoneid=3D13&source=3D&bl=
ock=3D0&capping=3D0&cb=3Dc7516a674cc214d4c163c1237aa78df4' width=3D'=
0' height=3D'0' alt=3D'' style=3D'width: 0px; height: 0px;'></div>
|
|
From: Noorez K. <dar...@ho...> - 2004-11-05 21:53:08
|
The building of my static and dynamic libraries freeze when they are beeing compiled. I checked all the directories but they are all valid. I think it froze when it couldn't find an object file but it is in the directory that I specified for object files in the project settings! _________________________________________________________________ Take charge with a pop-up guard built on patented Microsoft® SmartScreen Technology. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
|
From: Per W. <pw...@ia...> - 2004-11-05 17:06:35
|
Schoolwork is ment to reinvent the wheel to teach how a wheel works...
/Per W
On Fri, 5 Nov 2004, Cary Haynie wrote:
> i'd look into this handy little function from string.h if I were you:
>
> size_t strlen(const char* cs)
> returns the length of string cs without counting the terminator
>
> and, stdlib.h has a atoi (array to int) function already, so this is
> kinda reinventing the wheel, as most arch's that have a c compiler
> also have a complementary c library.
>
> also, converting a string to a regular int seems like it would only
> have limited use as you can only assume that an int is 16 bits, making
> the range of possible values this function can return 32767 to -32768
> or 0 65535 if it is an unsigned int. if you need to process arbitrary
> length numbers, there are some good, albeit non-standard libraries
> available for both c and c++
>
>
> good luck though.
> Cary
>
> On Fri, 5 Nov 2004 11:17:54 +0100 (CET), Per Westermark
> <pw...@ia...> wrote:
> > 1) If you have problems with school assignments, why don't you just admit
> > that? An embedded system - where there might not be an existing RTL,
> > forcing the developer to write it's own strtoi doesn't need wide character
> > support...
> >
> > 2) Why do a loop that both uses an index and counts size? Why isn't the
> > size variable enough to locate the last character. Why isn't this loop
> > breaking at the first non-digit?
> >
> > 3) Real strtoi doesn't write any error messages. There might not even be a
> > console for emitting any messages... It should just stop at the
> > first invalid character.
> >
> > 4) Why do nested loops for exponent? A real implementation converts from
> > end of string, just multiplying the previous sum by 10 every time it has
> > one more digit to process.
> >
> > 5) You have missed handling numbers starting with a sign. 6) How do you
> > think you can load a text string with scanf without allocating the memory.
> > You have a pointer but that doesn't point to a text buffer for storing
> > your digit string.
> >
> > /Per W
> >
> >
> >
> > On Fri, 5 Nov 2004, Justin Fan wrote:
> >
> > > Hi,
> > >
> > > I'm newer to C++ programming so I hope you can help me to improve my
> > > coding skill. Here is my first code to implement Strtoi(char*), please
> > > give me your feedback.
> > > My lead ask me to implement it as Strtoi(wchar*), but I can't find
> > > which head contains the definition of wchar and how to use it. And
> > > some known bugs are there after tesing:
> > >
> > > when I input a long string such as "12345678987654321", this app will crash.
> > > Also when I add a sentence before sleep(), it crashed.
> > >
> > > BTW, I want to know how to debug an app and how to track views I added.
> > >
> > > Any ideas?
> > >
> > > Thanks in advance and any suggestions will be appreciated!!
> > >
> > > #include <stdlib.h>
> > >
> > > int strtoi(char* a)
> > > {
> > >
> > > int sum=0,size=0,i=0;
> > >
> > > while(a[i]!='\0') // calculate the size of the array
> > > {i++;size++;}
> > >
> > > printf("The size of string is: %d\n",size);
> > > i=0;
> > >
> > >
> > > for(i=0;i<size;i++)
> > > {
> > > if (a[i]<'0' || a[i]>'9') //Don't deal with invalid strings
> > > { printf( "I think it's meaningless to covert a English word to
> > > int.\n Please input some string such as 123");
> > > return 0;
> > > }
> > > else
> > > {
> > > int j=0; //variable 'j' refers to the exponet of 10
> > > int temp=a[i]-'0'; //covert a[i] to a interger
> > > for(j=size-i-1;j>0;j--) //sum
> > > temp=temp*10;
> > >
> > > sum+=temp;
> > > }
> > > }
> > > printf("The result of convertion:%d\n",sum);
> > > return sum;
> > >
> > > }
> > > int main()
> > > {
> > > int i=0;
> > > char* a;
> > > printf("Please input your string,such as 123\n");
> > > scanf("%s",a);
> > > strtoi(a);
> > > sleep(100000);
> > > return 0;
> > > }
> > >
> > > --
> > > Thanks
> > > Z.J.
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by:
> > > Sybase ASE Linux Express Edition - download now for FREE
> > > LinuxWorld Reader's Choice Award Winner for best database on Linux.
> > > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by:
> > Sybase ASE Linux Express Edition - download now for FREE
> > LinuxWorld Reader's Choice Award Winner for best database on Linux.
> > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Cary H. <xen...@gm...> - 2004-11-05 15:31:10
|
i'd look into this handy little function from string.h if I were you:
size_t strlen(const char* cs)
returns the length of string cs without counting the terminator
and, stdlib.h has a atoi (array to int) function already, so this is
kinda reinventing the wheel, as most arch's that have a c compiler
also have a complementary c library.
also, converting a string to a regular int seems like it would only
have limited use as you can only assume that an int is 16 bits, making
the range of possible values this function can return 32767 to -32768
or 0 65535 if it is an unsigned int. if you need to process arbitrary
length numbers, there are some good, albeit non-standard libraries
available for both c and c++
good luck though.
Cary
On Fri, 5 Nov 2004 11:17:54 +0100 (CET), Per Westermark
<pw...@ia...> wrote:
> 1) If you have problems with school assignments, why don't you just admit
> that? An embedded system - where there might not be an existing RTL,
> forcing the developer to write it's own strtoi doesn't need wide character
> support...
>
> 2) Why do a loop that both uses an index and counts size? Why isn't the
> size variable enough to locate the last character. Why isn't this loop
> breaking at the first non-digit?
>
> 3) Real strtoi doesn't write any error messages. There might not even be a
> console for emitting any messages... It should just stop at the
> first invalid character.
>
> 4) Why do nested loops for exponent? A real implementation converts from
> end of string, just multiplying the previous sum by 10 every time it has
> one more digit to process.
>
> 5) You have missed handling numbers starting with a sign. 6) How do you
> think you can load a text string with scanf without allocating the memory.
> You have a pointer but that doesn't point to a text buffer for storing
> your digit string.
>
> /Per W
>
>
>
> On Fri, 5 Nov 2004, Justin Fan wrote:
>
> > Hi,
> >
> > I'm newer to C++ programming so I hope you can help me to improve my
> > coding skill. Here is my first code to implement Strtoi(char*), please
> > give me your feedback.
> > My lead ask me to implement it as Strtoi(wchar*), but I can't find
> > which head contains the definition of wchar and how to use it. And
> > some known bugs are there after tesing:
> >
> > when I input a long string such as "12345678987654321", this app will crash.
> > Also when I add a sentence before sleep(), it crashed.
> >
> > BTW, I want to know how to debug an app and how to track views I added.
> >
> > Any ideas?
> >
> > Thanks in advance and any suggestions will be appreciated!!
> >
> > #include <stdlib.h>
> >
> > int strtoi(char* a)
> > {
> >
> > int sum=0,size=0,i=0;
> >
> > while(a[i]!='\0') // calculate the size of the array
> > {i++;size++;}
> >
> > printf("The size of string is: %d\n",size);
> > i=0;
> >
> >
> > for(i=0;i<size;i++)
> > {
> > if (a[i]<'0' || a[i]>'9') //Don't deal with invalid strings
> > { printf( "I think it's meaningless to covert a English word to
> > int.\n Please input some string such as 123");
> > return 0;
> > }
> > else
> > {
> > int j=0; //variable 'j' refers to the exponet of 10
> > int temp=a[i]-'0'; //covert a[i] to a interger
> > for(j=size-i-1;j>0;j--) //sum
> > temp=temp*10;
> >
> > sum+=temp;
> > }
> > }
> > printf("The result of convertion:%d\n",sum);
> > return sum;
> >
> > }
> > int main()
> > {
> > int i=0;
> > char* a;
> > printf("Please input your string,such as 123\n");
> > scanf("%s",a);
> > strtoi(a);
> > sleep(100000);
> > return 0;
> > }
> >
> > --
> > Thanks
> > Z.J.
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by:
> > Sybase ASE Linux Express Edition - download now for FREE
> > LinuxWorld Reader's Choice Award Winner for best database on Linux.
> > http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Per W. <pw...@ia...> - 2004-11-05 10:18:08
|
1) If you have problems with school assignments, why don't you just admit
that? An embedded system - where there might not be an existing RTL,
forcing the developer to write it's own strtoi doesn't need wide character
support...
2) Why do a loop that both uses an index and counts size? Why isn't the
size variable enough to locate the last character. Why isn't this loop
breaking at the first non-digit?
3) Real strtoi doesn't write any error messages. There might not even be a
console for emitting any messages... It should just stop at the
first invalid character.
4) Why do nested loops for exponent? A real implementation converts from
end of string, just multiplying the previous sum by 10 every time it has
one more digit to process.
5) You have missed handling numbers starting with a sign. 6) How do you
think you can load a text string with scanf without allocating the memory.
You have a pointer but that doesn't point to a text buffer for storing
your digit string.
/Per W
On Fri, 5 Nov 2004, Justin Fan wrote:
> Hi,
>
> I'm newer to C++ programming so I hope you can help me to improve my
> coding skill. Here is my first code to implement Strtoi(char*), please
> give me your feedback.
> My lead ask me to implement it as Strtoi(wchar*), but I can't find
> which head contains the definition of wchar and how to use it. And
> some known bugs are there after tesing:
>
> when I input a long string such as "12345678987654321", this app will crash.
> Also when I add a sentence before sleep(), it crashed.
>
> BTW, I want to know how to debug an app and how to track views I added.
>
> Any ideas?
>
> Thanks in advance and any suggestions will be appreciated!!
>
> #include <stdlib.h>
>
> int strtoi(char* a)
> {
>
> int sum=0,size=0,i=0;
>
> while(a[i]!='\0') // calculate the size of the array
> {i++;size++;}
>
> printf("The size of string is: %d\n",size);
> i=0;
>
>
> for(i=0;i<size;i++)
> {
> if (a[i]<'0' || a[i]>'9') //Don't deal with invalid strings
> { printf( "I think it's meaningless to covert a English word to
> int.\n Please input some string such as 123");
> return 0;
> }
> else
> {
> int j=0; //variable 'j' refers to the exponet of 10
> int temp=a[i]-'0'; //covert a[i] to a interger
> for(j=size-i-1;j>0;j--) //sum
> temp=temp*10;
>
> sum+=temp;
> }
> }
> printf("The result of convertion:%d\n",sum);
> return sum;
>
> }
> int main()
> {
> int i=0;
> char* a;
> printf("Please input your string,such as 123\n");
> scanf("%s",a);
> strtoi(a);
> sleep(100000);
> return 0;
> }
>
> --
> Thanks
> Z.J.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Justin F. <jus...@gm...> - 2004-11-05 08:25:51
|
Hi,
I'm newer to C++ programming so I hope you can help me to improve my
coding skill. Here is my first code to implement Strtoi(char*), please
give me your feedback.
My lead ask me to implement it as Strtoi(wchar*), but I can't find
which head contains the definition of wchar and how to use it. And
some known bugs are there after tesing:
when I input a long string such as "12345678987654321", this app will crash.
Also when I add a sentence before sleep(), it crashed.
BTW, I want to know how to debug an app and how to track views I added.
Any ideas?
Thanks in advance and any suggestions will be appreciated!!
#include <stdlib.h>
int strtoi(char* a)
{
int sum=0,size=0,i=0;
while(a[i]!='\0') // calculate the size of the array
{i++;size++;}
printf("The size of string is: %d\n",size);
i=0;
for(i=0;i<size;i++)
{
if (a[i]<'0' || a[i]>'9') //Don't deal with invalid strings
{ printf( "I think it's meaningless to covert a English word to
int.\n Please input some string such as 123");
return 0;
}
else
{
int j=0; //variable 'j' refers to the exponet of 10
int temp=a[i]-'0'; //covert a[i] to a interger
for(j=size-i-1;j>0;j--) //sum
temp=temp*10;
sum+=temp;
}
}
printf("The result of convertion:%d\n",sum);
return sum;
}
int main()
{
int i=0;
char* a;
printf("Please input your string,such as 123\n");
scanf("%s",a);
strtoi(a);
sleep(100000);
return 0;
}
--
Thanks
Z.J.
|
|
From: Carlo <car...@li...> - 2004-11-05 08:08:10
|
Ni Jinfeng ha scritto lo scorso 04/11/2004 15.11:
> Hi, All.
>
>
>
> I am writing to ask for help from the Dev-C++ user community with the
> problem of calling dll from visual basic.
>
>
>
> I wrote a dll by using Dev-C++ and the dll works fine with an interface
> written in Dev-C++. However, when I tried to call the dll from an
> interface written in visual basic, I run into problem.
>
[cut]
>
> Jean Ni
>
I have already run in this problem (this is the reason why I thrashed VB
and now use GTK+ :-); the problem is in the different use of strings
between VB and C. A workaround that worked for me is the following:
1. change your library function to:
void _stdcall reportTime (char ** name)
2. change your function declaration to:
Private Declare Sub reportTime Lib "your.dll"
(ByRef name As String)
HTH
|
|
From: Justin F. <jus...@gm...> - 2004-11-05 02:17:57
|
Hi, I just read such infos that "Can I download these devpaks using Dev-C++ WebUpdate feature?Upgrade to latest Dev-C++ version (4.9.9.0) and in WebUpdate select devpaks.org as a mirror." on the devpak webpage. But I can't find where can I do it, I can't find somewhere to add mirror to list. does anyone know? BTW. who know the difference between <dev...@li...> with <dev...@li...>? -- Thanks Z.J. |
|
From: Per W. <pw...@ia...> - 2004-11-04 20:20:54
|
Clock skew is when make builds a file just to find out that the created output file has a time in the future. The most common cause is if you build on one machine and the files are stored on another machine. Make will then use the date/time of the build machine for deciding what to do. However, for a lot of network file protocols it is the machine owning the file system that sets the modify timestamp on the files. So if the clock on the file server is in the future relative to the build machine, this will happen. For the reverse condition, i.e. build machine has time in future relative to file server, make will sometime ignore building some files, since the newly saved source files have a time stamp older than the corresponding object file. However, for this case Make won't complain about clock skew - it will not be able to detect the problem, resulting in incomplete rebuilds. Whenever doing network builds, it is imperative to keep the time on the two machines synchronized, for example by letting both machines pick up current time from a ntp time reference server. /Per W On Thu, 4 Nov 2004, Noorez Kassam wrote: > [Warning] Clock skew detected. Your build may be incorrect. > > What is a clock skew...? > > _________________________________________________________________ > Powerful Parental Controls Let your child discover the best the Internet = has > to offer. > http://join.msn.com/?pgmarket=3Den-ca&page=3Dbyoa/prem&xAPID=3D1994&DI=3D= 1034&SU=3Dhttp://hotmail.com/enca&HL=3DMarket_MSNIS_Taglines > Start enjoying all the benefits of MSN=AE Premium right now and get the > first two months FREE*. > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Sybase ASE Linux Express Edition - download now for FREE > LinuxWorld Reader's Choice Award Winner for best database on Linux. > http://ads.osdn.com/?ad_id=3D5588&alloc_id=3D12065&op=3Dclick > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
|
From: Reid T. <Rei...@at...> - 2004-11-04 19:37:14
|
Noorez Kassam wrote: > [Warning] Clock skew detected. Your build may be incorrect. >=20 > What is a clock skew...? you have files in your build that have a timestamp that is later than the current time on your machine reid |
|
From: <wa...@wa...> - 2004-11-04 19:04:29
|
On 4 Nov 2004 at 11:09, Noorez Kassam wrote: > [Warning] Clock skew detected. Your build may be incorrect. > > What is a clock skew...? I can't say for sure but the date/time stamp on each file probably isn't making sense to the compiler. You might have a file that says it was created 5 days from now or several years in the future or something like that. Take a look at your files. Watson (the pencil neck) Davis |
|
From: Noorez K. <dar...@ho...> - 2004-11-04 18:10:22
|
[Warning] Clock skew detected. Your build may be incorrect. What is a clock skew...? _________________________________________________________________ Powerful Parental Controls Let your child discover the best the Internet has to offer. http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines Start enjoying all the benefits of MSN® Premium right now and get the first two months FREE*. |
|
From: Cary H. <xen...@gm...> - 2004-11-04 15:11:13
|
I'm not an expert at this, but here are a few ideas I had: 1. since you are passing a pointer, the parameter is passed by reference, not by value. This might explain why the function seems to work, but doesn't actually change the string, as ByVal causes the function to create a copy of the string and performs its work on the copy, leaving the original intact. So, try ByRef instead of ByVal 2. since c treats strings as character arrays, you might want to try using that as the parameter, as VB might treat strings differently than character arrays. 3. try using fastcall instead of stdcall. Again, these are just ideas. Good luck! On Thu, 4 Nov 2004 08:11:10 -0600, Ni Jinfeng <ni_...@ba...> wrote: > > > > Hi, All. > > > > I am writing to ask for help from the Dev-C++ user community with the > problem of calling dll from visual basic. > > > > I wrote a dll by using Dev-C++ and the dll works fine with an interface > written in Dev-C++. However, when I tried to call the dll from an interface > written in visual basic, I run into problem. > > > > The dll contains a function with prototype shown below. It concatenates the > time to the string "name". > > > > Void reportTime (char *name); > > > > I call the function in dll from visual basic by using the > following declare statement > > > > Private Declare Sub reportTime Lib "c:\dlltest-4\dlltest-4.dll" > (ByVal name As String) > > > > I get an error message "bad dll calling convention". > > > > So I made some change to the prototype of the function in dll by adding > _stdcall as shown below. > > > > Void _stdcall reportTime (char *name); > > > > The declare statement is the same in the visual basic interface. > > > > This time, I do not get the error message shown above and I can tell that > the string "name" is passed into dll and the function can concatenate the > time to the string. However, after the dll returns the control back to the > interface, the string "name" in the interface does not reflect the > manipulation done in dll. I do not know what to do. > > > > Thank you in advance for your time and help. > > > > Jean Ni > > > > |
|
From: Per W. <pw...@ia...> - 2004-11-04 14:59:37
|
Your basic program have specified the parameter as ByVal. For a normal value this means that a copy of the variable is sent as a parameter, i.e. changes will not be reflected back. Since I don't program VB, I don't know the definition of ByVal for a pointer-type parameter. If it is the pointer that is ByVal or if it is the string. In case it's the string that is ByVal, it is obvious why you don't get a change in the VB program - the changes are only to a copy of the string and are immediately thrown away on return from the function. /Per W On Thu, 4 Nov 2004, Ni Jinfeng wrote: > Hi, All. > > > > I am writing to ask for help from the Dev-C++ user community with the > problem of calling dll from visual basic. > > > > I wrote a dll by using Dev-C++ and the dll works fine with an interface > written in Dev-C++. However, when I tried to call the dll from an interface > written in visual basic, I run into problem. > > > > 1. The dll contains a function with prototype shown below. It > concatenates the time to the string "name". > > > > Void reportTime (char *name); > > > > I call the function in dll from visual basic by using the > following declare statement > > > > Private Declare Sub reportTime Lib "c:\dlltest-4\dlltest-4.dll" > (ByVal name As String) > > > > I get an error message "bad dll calling convention". > > > > 2. So I made some change to the prototype of the function in dll by > adding _stdcall as shown below. > > > > Void _stdcall reportTime (char *name); > > > > The declare statement is the same in the visual basic interface. > > > > This time, I do not get the error message shown above and I can tell that > the string "name" is passed into dll and the function can concatenate the > time to the string. However, after the dll returns the control back to the > interface, the string "name" in the interface does not reflect the > manipulation done in dll. I do not know what to do. > > > > Thank you in advance for your time and help. > > > > Jean Ni > > > > > > |