Click here to Skip to main content
15,926,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generaluniq new filename Pin
JGranborg2-Jan-03 2:33
JGranborg2-Jan-03 2:33 
GeneralRe: uniq new filename Pin
Joaquín M López Muñoz2-Jan-03 2:56
Joaquín M López Muñoz2-Jan-03 2:56 
GeneralRe: uniq new filename Pin
JGranborg2-Jan-03 20:58
JGranborg2-Jan-03 20:58 
GeneralUTF-8 to UCS-2 conversion tool (both ways ) Pin
gracias_carol2-Jan-03 2:01
gracias_carol2-Jan-03 2:01 
QuestionFormatted input? Pin
Jamie Hale2-Jan-03 1:56
Jamie Hale2-Jan-03 1:56 
AnswerRe: Formatted input? Pin
Joaquín M López Muñoz2-Jan-03 2:18
Joaquín M López Muñoz2-Jan-03 2:18 
GeneralRe: Formatted input? Pin
Jamie Hale2-Jan-03 2:30
Jamie Hale2-Jan-03 2:30 
GeneralRe: Formatted input? Pin
Joaquín M López Muñoz2-Jan-03 2:52
Joaquín M López Muñoz2-Jan-03 2:52 
Well, maybe regexps are a little overkill for this task, but it depends on how confident you are about this format not changing in the future. Anyway, if you're sure this won't change and don't want to mess with regexps, I think sscanf is your best ally here:
#include <stdio.h>
#include <stdlib.h>
 
bool my_precious_parser(const char* str,int& prefix,int& suffix)
{
  char str_prefix[1024]="0",str_suffix[1024];
  if(
    sscanf(
      str,
      "%[012345689]d%[0123456789]",
      str_prefix,str_suffix)!=2 &&
    sscanf(
      str,
      "d%[0123456789]",
      str_suffix)!=1){
    return false;
  }
  prefix=atoi(str_prefix);
  suffix=atoi(str_suffix);
  return true;
}


Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralUpdating statusbar (in ChildFrm) in MDI-project Pin
2-Jan-03 1:33
suss2-Jan-03 1:33 
GeneralRe: Updating statusbar (in ChildFrm) in MDI-project Pin
RobJones2-Jan-03 2:15
RobJones2-Jan-03 2:15 
General' Multicolumn ' CMonthCalControl Pin
lbc2-Jan-03 1:05
lbc2-Jan-03 1:05 
GeneralRe: ' Multicolumn ' CMonthCalControl Pin
Matt Gullett2-Jan-03 1:12
Matt Gullett2-Jan-03 1:12 
GeneralRe: ' Multicolumn ' CMonthCalControl Pin
lbc2-Jan-03 4:20
lbc2-Jan-03 4:20 
QuestionDirectory exist? Pin
r i s h a b h s1-Jan-03 22:55
r i s h a b h s1-Jan-03 22:55 
AnswerRe: Directory exist? Pin
Renjith Ramachandran1-Jan-03 23:18
Renjith Ramachandran1-Jan-03 23:18 
AnswerRe: Directory exist? Pin
Hesham Amin1-Jan-03 23:26
Hesham Amin1-Jan-03 23:26 
AnswerRe: Directory exist? Pin
Kannan Kalyanaraman2-Jan-03 0:20
Kannan Kalyanaraman2-Jan-03 0:20 
AnswerRe: Directory exist? Pin
Joaquín M López Muñoz2-Jan-03 2:29
Joaquín M López Muñoz2-Jan-03 2:29 
AnswerRe: Directory exist? Pin
Navin2-Jan-03 6:20
Navin2-Jan-03 6:20 
GeneralCFiledialog Pin
sujtha1-Jan-03 22:24
sujtha1-Jan-03 22:24 
GeneralRe: CFiledialog Pin
Neville Franks2-Jan-03 14:49
Neville Franks2-Jan-03 14:49 
GeneralExcel Automation Pin
Renjith Ramachandran1-Jan-03 22:13
Renjith Ramachandran1-Jan-03 22:13 
GeneralRe: Excel Automation Pin
Kannan Kalyanaraman2-Jan-03 0:26
Kannan Kalyanaraman2-Jan-03 0:26 
GeneralRe: Excel Automation Pin
Kannan Kalyanaraman2-Jan-03 0:29
Kannan Kalyanaraman2-Jan-03 0:29 
GeneralRe: Excel Automation Pin
Renjith Ramachandran2-Jan-03 2:18
Renjith Ramachandran2-Jan-03 2:18 

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.