Click here to Skip to main content
15,904,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionState Machine to C code and back Pin
NelsonGoncalves14-Jan-21 0:30
NelsonGoncalves14-Jan-21 0:30 
AnswerRe: State Machine to C code and back Pin
Richard Andrew x6418-Jan-21 12:11
professionalRichard Andrew x6418-Jan-21 12:11 
GeneralRe: State Machine to C code and back Pin
NelsonGoncalves18-Jan-21 23:09
NelsonGoncalves18-Jan-21 23:09 
AnswerRe: State Machine to C code and back Pin
trønderen20-Jan-21 9:29
trønderen20-Jan-21 9:29 
GeneralRe: State Machine to C code and back Pin
NelsonGoncalves21-Jan-21 21:17
NelsonGoncalves21-Jan-21 21:17 
GeneralRe: State Machine to C code and back Pin
kalberts21-Jan-21 23:31
kalberts21-Jan-21 23:31 
GeneralRe: State Machine to C code and back Pin
Greg Utas22-Jan-21 1:30
professionalGreg Utas22-Jan-21 1:30 
QuestionMessage Closed Pin
12-Jan-21 11:59
Member 1496877112-Jan-21 11:59 
AnswerRe: C++ template function returning "vector" ? Pin
Greg Utas12-Jan-21 12:24
professionalGreg Utas12-Jan-21 12:24 
AnswerRe: C++ template function returning "vector" ? Pin
CPallini12-Jan-21 21:20
mveCPallini12-Jan-21 21:20 
GeneralMessage Closed Pin
13-Jan-21 4:57
Member 1496877113-Jan-21 4:57 
GeneralRe: C++ template function returning "vector" ? Pin
Richard MacCutchan13-Jan-21 5:40
mveRichard MacCutchan13-Jan-21 5:40 
GeneralRe: C++ template function returning "vector" ? Pin
CPallini13-Jan-21 7:05
mveCPallini13-Jan-21 7:05 
QuestionCCombox Pin
JM225111-Jan-21 20:19
JM225111-Jan-21 20:19 
AnswerRe: CCombox Pin
Richard MacCutchan11-Jan-21 22:41
mveRichard MacCutchan11-Jan-21 22:41 
QuestionCMFCRibbonComboBox Pin
Member 1325158811-Jan-21 16:31
Member 1325158811-Jan-21 16:31 
AnswerRe: CMFCRibbonComboBox Pin
Richard MacCutchan11-Jan-21 22:39
mveRichard MacCutchan11-Jan-21 22:39 
GeneralRe: CMFCRibbonComboBox Pin
Member 1325158812-Jan-21 9:18
Member 1325158812-Jan-21 9:18 
GeneralRe: CMFCRibbonComboBox Pin
Victor Nijegorodov12-Jan-21 10:12
Victor Nijegorodov12-Jan-21 10:12 
GeneralRe: CMFCRibbonComboBox Pin
Member 1325158812-Jan-21 16:23
Member 1325158812-Jan-21 16:23 
GeneralRe: CMFCRibbonComboBox Pin
Victor Nijegorodov12-Jan-21 21:07
Victor Nijegorodov12-Jan-21 21:07 
GeneralRe: CMFCRibbonComboBox Pin
Richard MacCutchan12-Jan-21 21:24
mveRichard MacCutchan12-Jan-21 21:24 
QuestionC Programming code to build an echo varient that hopefully can be used in WinXP Pin
jackngill11-Jan-21 10:49
jackngill11-Jan-21 10:49 
Sorry for the cryptic nature of this question just trying to condense as much as I can.

I am trying to write a program in "C" which has a twist on the normal echo command in XPSP3
XP echo does not allow you to remove EOL characters when you redirect into text file with the >
I think they call it CRLF. However in my wanderings I have come across some "C" code that I think could compile a useful program. Here is some background info to illustrate:
The program that I hope to use would be called ECO.COM would be commandline for usage in CMD
ECO would be furnished with a flag (-X) that would give the user the choice to include the CRLF removal or would just be used just like echo command in XP without the -X flag. The ECO.COM file would be restricted to one line (80 Chars) long so the following could take place. The user could type for example
ECO.COM -X SET VARIABLE= (the ECO.COM would have with the -X flag to strip out the end CRLF so once the
SET VARIABLE= line was ridected to text file could easily be appended (>>) with a second ECO command or text file all on the same line. The resultant Text file could then be renamed to a .CMD file & called from another batch file thus setting the given %Variable%
I think they call it backticks or command substitution or some call it back quotes anyway here is the code which I have sought & tried to compile to create ECO.COM/EXE but it is not working can someone assist to make it work Please I think it would be very useful alternative to SET/P option in XPCMD?Thumbs Up | :thumbsup:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

       /* setting flag to remove crlf */
int main()
{
for (i = 1; i < argc; i++) {

            /* Check for a switch (leading "-"). */

        if (argv[i][0] == '-') {

            /* Use the next character to decide what to do. */

            switch (argv[i][1]) {

                case 'x':
                        printf("flag a was called\n");
                        break;

        }
    }
}

        /* part of script that echos 80 chars on one line */

int echo()
{
    char input[80];
    while(fgets(input, 80, STDIN)){  //read from STDIN (aka command-line)
        printf("%s\n", input);  //print out what user typed in
        memset(input, 0, strlen(input));  //reset string to all 0's

    return 1;
}

        /*  go to exit if the user enters -x flag */

      if (*char == -x) {
         goto remit;

      else

      if (*char == " ") {
         goto exit;
}
             /* remove carriage returns from one line /*


         remit;
int main()
{
    const char *remove_any_of = "\n\r";
    int c;
    while((c = getchar()) != EOF) {
        if (!strchr(remove_any_of, c)) putchar(c);

         exit;

    return 0;
}


Best Regards
JacknGill Big Grin | :-D

modified 12-Jan-21 15:57pm.

QuestionRe: C Programming code to build an echo varient that hopefully can be used in WinXP Pin
David Crow11-Jan-21 16:36
David Crow11-Jan-21 16:36 
AnswerRe: C Programming code to build an echo varient that hopefully can be used in WinXP Pin
jackngill11-Jan-21 22:25
jackngill11-Jan-21 22:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.