Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using _itoa or converting int to char
Message
General information
Forum:
Visual C++
Category:
Other
Miscellaneous
Thread ID:
00677359
Message ID:
00677371
Views:
21
>Hi, when i try to convert int to char with _itoa, dont work in my machine, exist a different way for do this job?
>
>this is my code:
>
>char szFile[12] = "";
>char buffer[33];
>int i = 0;
>_itoa(i,buffer,10);
>lstrcat( szFile, "portlog");
>lstrcat( szFile, buffer);
>lstrcat( szFile, ".dbf");
>//lstrcpy(szFile,szFile);
>AfxMessageBox(szFile);
>
>thanks in advance
>
>Regards
>
>Francisco Morosini

It seemed to work for me. I just created a simple console app, set it to include MFC, and used the code:
#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <Afxwin.h>


int main(int argc, char* argv[])
{
    char szFile[12] = "";
    char buffer[33];
    int i = 0;
    _itoa(i,buffer,10); 	
    lstrcat( szFile, "portlog"); 
    lstrcat( szFile, buffer); 
    lstrcat( szFile, ".dbf"); 

    AfxMessageBox(szFile);
    return 0;
It displays: portlog0.dbf in a messagebox w/an OK button. What kind of problem are you having?
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform